apache-airflow-providers-snowflake 5.8.1__tar.gz → 6.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of apache-airflow-providers-snowflake might be problematic. Click here for more details.
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/PKG-INFO +9 -13
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/README.rst +4 -4
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/__init__.py +3 -3
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/decorators/snowpark.py +2 -1
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/get_provider_info.py +3 -2
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/hooks/snowflake.py +35 -5
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/operators/snowflake.py +5 -105
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/operators/snowpark.py +2 -1
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/transfers/copy_into_snowflake.py +2 -1
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/triggers/snowflake_trigger.py +2 -1
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/pyproject.toml +5 -11
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/LICENSE +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/decorators/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/hooks/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/hooks/snowflake_sql_api.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/operators/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/transfers/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/triggers/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/utils/__init__.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/utils/common.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/utils/openlineage.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/utils/snowpark.py +0 -0
- {apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/airflow/providers/snowflake/utils/sql_api_generate_jwt.py +0 -0
{apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: apache-airflow-providers-snowflake
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: Provider package apache-airflow-providers-snowflake for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,snowflake,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -22,25 +22,21 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
22
22
|
Classifier: Topic :: System :: Monitoring
|
|
23
23
|
Requires-Dist: apache-airflow-providers-common-compat>=1.1.0
|
|
24
24
|
Requires-Dist: apache-airflow-providers-common-sql>=1.20.0
|
|
25
|
-
Requires-Dist: apache-airflow>=2.
|
|
25
|
+
Requires-Dist: apache-airflow>=2.9.0
|
|
26
26
|
Requires-Dist: pandas>=1.5.3,<2.2;python_version<"3.9"
|
|
27
27
|
Requires-Dist: pandas>=2.1.2,<2.2;python_version>="3.9"
|
|
28
28
|
Requires-Dist: pyarrow>=14.0.1
|
|
29
29
|
Requires-Dist: snowflake-connector-python>=3.7.1
|
|
30
30
|
Requires-Dist: snowflake-snowpark-python>=1.17.0;python_version<"3.12"
|
|
31
31
|
Requires-Dist: snowflake-sqlalchemy>=1.4.0
|
|
32
|
-
Requires-Dist: apache-airflow-providers-common-compat ; extra == "common-compat"
|
|
33
|
-
Requires-Dist: apache-airflow-providers-common-sql ; extra == "common-sql"
|
|
34
32
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
35
33
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
36
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
37
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
34
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/changelog.html
|
|
35
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0
|
|
38
36
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
39
37
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
40
|
-
Project-URL: Twitter, https://
|
|
38
|
+
Project-URL: Twitter, https://x.com/ApacheAirflow
|
|
41
39
|
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
42
|
-
Provides-Extra: common-compat
|
|
43
|
-
Provides-Extra: common-sql
|
|
44
40
|
Provides-Extra: openlineage
|
|
45
41
|
|
|
46
42
|
|
|
@@ -87,7 +83,7 @@ Provides-Extra: openlineage
|
|
|
87
83
|
|
|
88
84
|
Package ``apache-airflow-providers-snowflake``
|
|
89
85
|
|
|
90
|
-
Release: ``
|
|
86
|
+
Release: ``6.0.0``
|
|
91
87
|
|
|
92
88
|
|
|
93
89
|
`Snowflake <https://www.snowflake.com/>`__
|
|
@@ -100,7 +96,7 @@ This is a provider package for ``snowflake`` provider. All classes for this prov
|
|
|
100
96
|
are in ``airflow.providers.snowflake`` python package.
|
|
101
97
|
|
|
102
98
|
You can find package information and changelog for the provider
|
|
103
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
99
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/>`_.
|
|
104
100
|
|
|
105
101
|
Installation
|
|
106
102
|
------------
|
|
@@ -117,7 +113,7 @@ Requirements
|
|
|
117
113
|
========================================== =========================================
|
|
118
114
|
PIP package Version required
|
|
119
115
|
========================================== =========================================
|
|
120
|
-
``apache-airflow`` ``>=2.
|
|
116
|
+
``apache-airflow`` ``>=2.9.0``
|
|
121
117
|
``apache-airflow-providers-common-compat`` ``>=1.1.0``
|
|
122
118
|
``apache-airflow-providers-common-sql`` ``>=1.20.0``
|
|
123
119
|
``pandas`` ``>=2.1.2,<2.2; python_version >= "3.9"``
|
|
@@ -150,4 +146,4 @@ Dependent package
|
|
|
150
146
|
================================================================================================================== =================
|
|
151
147
|
|
|
152
148
|
The changelog for the provider package can be found in the
|
|
153
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
149
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/changelog.html>`_.
|
{apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/README.rst
RENAMED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Package ``apache-airflow-providers-snowflake``
|
|
44
44
|
|
|
45
|
-
Release: ``
|
|
45
|
+
Release: ``6.0.0``
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
`Snowflake <https://www.snowflake.com/>`__
|
|
@@ -55,7 +55,7 @@ This is a provider package for ``snowflake`` provider. All classes for this prov
|
|
|
55
55
|
are in ``airflow.providers.snowflake`` python package.
|
|
56
56
|
|
|
57
57
|
You can find package information and changelog for the provider
|
|
58
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/>`_.
|
|
59
59
|
|
|
60
60
|
Installation
|
|
61
61
|
------------
|
|
@@ -72,7 +72,7 @@ Requirements
|
|
|
72
72
|
========================================== =========================================
|
|
73
73
|
PIP package Version required
|
|
74
74
|
========================================== =========================================
|
|
75
|
-
``apache-airflow`` ``>=2.
|
|
75
|
+
``apache-airflow`` ``>=2.9.0``
|
|
76
76
|
``apache-airflow-providers-common-compat`` ``>=1.1.0``
|
|
77
77
|
``apache-airflow-providers-common-sql`` ``>=1.20.0``
|
|
78
78
|
``pandas`` ``>=2.1.2,<2.2; python_version >= "3.9"``
|
|
@@ -105,4 +105,4 @@ Dependent package
|
|
|
105
105
|
================================================================================================================== =================
|
|
106
106
|
|
|
107
107
|
The changelog for the provider package can be found in the
|
|
108
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
108
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/changelog.html>`_.
|
|
@@ -29,11 +29,11 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "
|
|
32
|
+
__version__ = "6.0.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
|
-
"2.
|
|
35
|
+
"2.9.0"
|
|
36
36
|
):
|
|
37
37
|
raise RuntimeError(
|
|
38
|
-
f"The package `apache-airflow-providers-snowflake:{__version__}` needs Apache Airflow 2.
|
|
38
|
+
f"The package `apache-airflow-providers-snowflake:{__version__}` needs Apache Airflow 2.9.0+"
|
|
39
39
|
)
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import Sequence
|
|
21
|
+
from typing import TYPE_CHECKING, Callable
|
|
21
22
|
|
|
22
23
|
from airflow.decorators.base import DecoratedOperator, task_decorator_factory
|
|
23
24
|
from airflow.providers.snowflake.operators.snowpark import SnowparkOperator
|
|
@@ -28,8 +28,9 @@ def get_provider_info():
|
|
|
28
28
|
"name": "Snowflake",
|
|
29
29
|
"description": "`Snowflake <https://www.snowflake.com/>`__\n",
|
|
30
30
|
"state": "ready",
|
|
31
|
-
"source-date-epoch":
|
|
31
|
+
"source-date-epoch": 1734536683,
|
|
32
32
|
"versions": [
|
|
33
|
+
"6.0.0",
|
|
33
34
|
"5.8.1",
|
|
34
35
|
"5.8.0",
|
|
35
36
|
"5.7.1",
|
|
@@ -85,7 +86,7 @@ def get_provider_info():
|
|
|
85
86
|
"1.0.0",
|
|
86
87
|
],
|
|
87
88
|
"dependencies": [
|
|
88
|
-
"apache-airflow>=2.
|
|
89
|
+
"apache-airflow>=2.9.0",
|
|
89
90
|
"apache-airflow-providers-common-compat>=1.1.0",
|
|
90
91
|
"apache-airflow-providers-common-sql>=1.20.0",
|
|
91
92
|
'pandas>=2.1.2,<2.2;python_version>="3.9"',
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import os
|
|
21
|
+
from collections.abc import Iterable, Mapping
|
|
21
22
|
from contextlib import closing, contextmanager
|
|
22
23
|
from functools import cached_property
|
|
23
24
|
from io import StringIO
|
|
24
25
|
from pathlib import Path
|
|
25
|
-
from typing import TYPE_CHECKING, Any, Callable,
|
|
26
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
|
|
26
27
|
from urllib.parse import urlparse
|
|
27
28
|
|
|
28
29
|
from cryptography.hazmat.backends import default_backend
|
|
@@ -81,9 +82,6 @@ class SnowflakeHook(DbApiHook):
|
|
|
81
82
|
.. note::
|
|
82
83
|
``get_sqlalchemy_engine()`` depends on ``snowflake-sqlalchemy``
|
|
83
84
|
|
|
84
|
-
.. seealso::
|
|
85
|
-
For more information on how to use this Snowflake connection, take a look at the guide:
|
|
86
|
-
:ref:`howto/operator:SnowflakeOperator`
|
|
87
85
|
"""
|
|
88
86
|
|
|
89
87
|
conn_name_attr = "snowflake_conn_id"
|
|
@@ -133,6 +131,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
133
131
|
"private_key_file": "private key",
|
|
134
132
|
"session_parameters": "session parameters",
|
|
135
133
|
"client_request_mfa_token": "client request mfa token",
|
|
134
|
+
"client_store_temporary_credential": "client store temporary credential (externalbrowser mode)",
|
|
136
135
|
},
|
|
137
136
|
indent=1,
|
|
138
137
|
),
|
|
@@ -161,6 +160,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
161
160
|
self.authenticator = kwargs.pop("authenticator", None)
|
|
162
161
|
self.session_parameters = kwargs.pop("session_parameters", None)
|
|
163
162
|
self.client_request_mfa_token = kwargs.pop("client_request_mfa_token", None)
|
|
163
|
+
self.client_store_temporary_credential = kwargs.pop("client_store_temporary_credential", None)
|
|
164
164
|
self.query_ids: list[str] = []
|
|
165
165
|
|
|
166
166
|
def _get_field(self, extra_dict, field_name):
|
|
@@ -200,8 +200,14 @@ class SnowflakeHook(DbApiHook):
|
|
|
200
200
|
region = self._get_field(extra_dict, "region") or ""
|
|
201
201
|
role = self._get_field(extra_dict, "role") or ""
|
|
202
202
|
insecure_mode = _try_to_boolean(self._get_field(extra_dict, "insecure_mode"))
|
|
203
|
+
json_result_force_utf8_decoding = _try_to_boolean(
|
|
204
|
+
self._get_field(extra_dict, "json_result_force_utf8_decoding")
|
|
205
|
+
)
|
|
203
206
|
schema = conn.schema or ""
|
|
204
207
|
client_request_mfa_token = _try_to_boolean(self._get_field(extra_dict, "client_request_mfa_token"))
|
|
208
|
+
client_store_temporary_credential = _try_to_boolean(
|
|
209
|
+
self._get_field(extra_dict, "client_store_temporary_credential")
|
|
210
|
+
)
|
|
205
211
|
|
|
206
212
|
# authenticator and session_parameters never supported long name so we don't use _get_field
|
|
207
213
|
authenticator = extra_dict.get("authenticator", "snowflake")
|
|
@@ -224,9 +230,15 @@ class SnowflakeHook(DbApiHook):
|
|
|
224
230
|
if insecure_mode:
|
|
225
231
|
conn_config["insecure_mode"] = insecure_mode
|
|
226
232
|
|
|
233
|
+
if json_result_force_utf8_decoding:
|
|
234
|
+
conn_config["json_result_force_utf8_decoding"] = json_result_force_utf8_decoding
|
|
235
|
+
|
|
227
236
|
if client_request_mfa_token:
|
|
228
237
|
conn_config["client_request_mfa_token"] = client_request_mfa_token
|
|
229
238
|
|
|
239
|
+
if client_store_temporary_credential:
|
|
240
|
+
conn_config["client_store_temporary_credential"] = client_store_temporary_credential
|
|
241
|
+
|
|
230
242
|
# If private_key_file is specified in the extra json, load the contents of the file as a private key.
|
|
231
243
|
# If private_key_content is specified in the extra json, use it as a private key.
|
|
232
244
|
# As a next step, specify this private key in the connection configuration.
|
|
@@ -279,6 +291,14 @@ class SnowflakeHook(DbApiHook):
|
|
|
279
291
|
conn_config.pop("login", None)
|
|
280
292
|
conn_config.pop("password", None)
|
|
281
293
|
|
|
294
|
+
# configure custom target hostname and port, if specified
|
|
295
|
+
snowflake_host = extra_dict.get("host")
|
|
296
|
+
snowflake_port = extra_dict.get("port")
|
|
297
|
+
if snowflake_host:
|
|
298
|
+
conn_config["host"] = snowflake_host
|
|
299
|
+
if snowflake_port:
|
|
300
|
+
conn_config["port"] = snowflake_port
|
|
301
|
+
|
|
282
302
|
return conn_config
|
|
283
303
|
|
|
284
304
|
def get_uri(self) -> str:
|
|
@@ -293,7 +313,14 @@ class SnowflakeHook(DbApiHook):
|
|
|
293
313
|
for k, v in conn_params.items()
|
|
294
314
|
if v
|
|
295
315
|
and k
|
|
296
|
-
not in [
|
|
316
|
+
not in [
|
|
317
|
+
"session_parameters",
|
|
318
|
+
"insecure_mode",
|
|
319
|
+
"private_key",
|
|
320
|
+
"client_request_mfa_token",
|
|
321
|
+
"client_store_temporary_credential",
|
|
322
|
+
"json_result_force_utf8_decoding",
|
|
323
|
+
]
|
|
297
324
|
}
|
|
298
325
|
)
|
|
299
326
|
|
|
@@ -315,6 +342,9 @@ class SnowflakeHook(DbApiHook):
|
|
|
315
342
|
if "insecure_mode" in conn_params:
|
|
316
343
|
engine_kwargs.setdefault("connect_args", {})
|
|
317
344
|
engine_kwargs["connect_args"]["insecure_mode"] = True
|
|
345
|
+
if "json_result_force_utf8_decoding" in conn_params:
|
|
346
|
+
engine_kwargs.setdefault("connect_args", {})
|
|
347
|
+
engine_kwargs["connect_args"]["json_result_force_utf8_decoding"] = True
|
|
318
348
|
for key in ["session_parameters", "private_key"]:
|
|
319
349
|
if conn_params.get(key):
|
|
320
350
|
engine_kwargs.setdefault("connect_args", {})
|
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import time
|
|
21
|
+
from collections.abc import Iterable, Mapping, Sequence
|
|
21
22
|
from datetime import timedelta
|
|
22
|
-
from typing import TYPE_CHECKING, Any,
|
|
23
|
-
|
|
24
|
-
from deprecated import deprecated
|
|
23
|
+
from typing import TYPE_CHECKING, Any, SupportsAbs, cast
|
|
25
24
|
|
|
26
25
|
from airflow.configuration import conf
|
|
27
|
-
from airflow.exceptions import AirflowException
|
|
26
|
+
from airflow.exceptions import AirflowException
|
|
28
27
|
from airflow.providers.common.sql.operators.sql import (
|
|
29
28
|
SQLCheckOperator,
|
|
30
29
|
SQLExecuteQueryOperator,
|
|
@@ -38,105 +37,6 @@ if TYPE_CHECKING:
|
|
|
38
37
|
from airflow.utils.context import Context
|
|
39
38
|
|
|
40
39
|
|
|
41
|
-
@deprecated(
|
|
42
|
-
reason=(
|
|
43
|
-
"This class is deprecated. Please use "
|
|
44
|
-
"`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`. "
|
|
45
|
-
"Also, you can provide `hook_params={'warehouse': <warehouse>, 'database': <database>, "
|
|
46
|
-
"'role': <role>, 'schema': <schema>, 'authenticator': <authenticator>,"
|
|
47
|
-
"'session_parameters': <session_parameters>}`."
|
|
48
|
-
),
|
|
49
|
-
category=AirflowProviderDeprecationWarning,
|
|
50
|
-
)
|
|
51
|
-
class SnowflakeOperator(SQLExecuteQueryOperator):
|
|
52
|
-
"""
|
|
53
|
-
Executes SQL code in a Snowflake database.
|
|
54
|
-
|
|
55
|
-
This class is deprecated.
|
|
56
|
-
|
|
57
|
-
Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.
|
|
58
|
-
|
|
59
|
-
.. seealso::
|
|
60
|
-
For more information on how to use this operator, take a look at the guide:
|
|
61
|
-
:ref:`howto/operator:SnowflakeOperator`
|
|
62
|
-
|
|
63
|
-
:param snowflake_conn_id: Reference to
|
|
64
|
-
:ref:`Snowflake connection id<howto/connection:snowflake>`
|
|
65
|
-
:param sql: the SQL code to be executed as a single string, or
|
|
66
|
-
a list of str (sql statements), or a reference to a template file.
|
|
67
|
-
Template references are recognized by str ending in '.sql'
|
|
68
|
-
:param parameters: (optional) the parameters to render the SQL query with.
|
|
69
|
-
:param warehouse: name of warehouse (will overwrite any warehouse
|
|
70
|
-
defined in the connection's extra JSON)
|
|
71
|
-
:param database: name of database (will overwrite database defined
|
|
72
|
-
in connection)
|
|
73
|
-
:param schema: name of schema (will overwrite schema defined in
|
|
74
|
-
connection)
|
|
75
|
-
:param role: name of role (will overwrite any role defined in
|
|
76
|
-
connection's extra JSON)
|
|
77
|
-
:param authenticator: authenticator for Snowflake.
|
|
78
|
-
'snowflake' (default) to use the internal Snowflake authenticator
|
|
79
|
-
'externalbrowser' to authenticate using your web browser and
|
|
80
|
-
Okta, ADFS or any other SAML 2.0-compliant identify provider
|
|
81
|
-
(IdP) that has been defined for your account
|
|
82
|
-
'https://<your_okta_account_name>.okta.com' to authenticate
|
|
83
|
-
through native Okta.
|
|
84
|
-
:param session_parameters: You can set session-level parameters at
|
|
85
|
-
the time you connect to Snowflake
|
|
86
|
-
:return Returns list of dictionaries in { 'column': 'value', 'column2': 'value2' } form.
|
|
87
|
-
"""
|
|
88
|
-
|
|
89
|
-
template_fields: Sequence[str] = ("sql",)
|
|
90
|
-
template_ext: Sequence[str] = (".sql",)
|
|
91
|
-
template_fields_renderers: ClassVar[dict] = {"sql": "sql"}
|
|
92
|
-
ui_color = "#ededed"
|
|
93
|
-
|
|
94
|
-
def __init__(
|
|
95
|
-
self,
|
|
96
|
-
*,
|
|
97
|
-
snowflake_conn_id: str = "snowflake_default",
|
|
98
|
-
warehouse: str | None = None,
|
|
99
|
-
database: str | None = None,
|
|
100
|
-
role: str | None = None,
|
|
101
|
-
schema: str | None = None,
|
|
102
|
-
authenticator: str | None = None,
|
|
103
|
-
session_parameters: dict | None = None,
|
|
104
|
-
**kwargs,
|
|
105
|
-
) -> None:
|
|
106
|
-
if any([warehouse, database, role, schema, authenticator, session_parameters]):
|
|
107
|
-
hook_params = kwargs.pop("hook_params", {})
|
|
108
|
-
kwargs["hook_params"] = {
|
|
109
|
-
"warehouse": warehouse,
|
|
110
|
-
"database": database,
|
|
111
|
-
"role": role,
|
|
112
|
-
"schema": schema,
|
|
113
|
-
"authenticator": authenticator,
|
|
114
|
-
"session_parameters": session_parameters,
|
|
115
|
-
**hook_params,
|
|
116
|
-
}
|
|
117
|
-
super().__init__(conn_id=snowflake_conn_id, **kwargs)
|
|
118
|
-
|
|
119
|
-
def _process_output(self, results: list[Any], descriptions: list[Sequence[Sequence] | None]) -> list[Any]:
|
|
120
|
-
validated_descriptions: list[Sequence[Sequence]] = []
|
|
121
|
-
for idx, description in enumerate(descriptions):
|
|
122
|
-
if not description:
|
|
123
|
-
raise RuntimeError(
|
|
124
|
-
f"The query did not return descriptions of the cursor for query number {idx}. "
|
|
125
|
-
"Cannot return values in a form of dictionary for that query."
|
|
126
|
-
)
|
|
127
|
-
validated_descriptions.append(description)
|
|
128
|
-
returned_results = []
|
|
129
|
-
for result_id, result_list in enumerate(results):
|
|
130
|
-
current_processed_result = []
|
|
131
|
-
for row in result_list:
|
|
132
|
-
dict_result: dict[Any, Any] = {}
|
|
133
|
-
for idx, description in enumerate(validated_descriptions[result_id]):
|
|
134
|
-
dict_result[description[0]] = row[idx]
|
|
135
|
-
current_processed_result.append(dict_result)
|
|
136
|
-
returned_results.append(current_processed_result)
|
|
137
|
-
return returned_results
|
|
138
|
-
|
|
139
|
-
|
|
140
40
|
class SnowflakeCheckOperator(SQLCheckOperator):
|
|
141
41
|
"""
|
|
142
42
|
Performs a check against Snowflake.
|
|
@@ -391,7 +291,7 @@ class SnowflakeIntervalCheckOperator(SQLIntervalCheckOperator):
|
|
|
391
291
|
class SnowflakeSqlApiOperator(SQLExecuteQueryOperator):
|
|
392
292
|
"""
|
|
393
293
|
Implemented Snowflake SQL API Operator to support multiple SQL statements sequentially,
|
|
394
|
-
which is the behavior of the
|
|
294
|
+
which is the behavior of the SQLExecuteQueryOperator, the Snowflake SQL API allows submitting
|
|
395
295
|
multiple SQL statements in a single request. It make post request to submit SQL
|
|
396
296
|
statements for execution, poll to check the status of the execution of a statement. Fetch query results
|
|
397
297
|
concurrently.
|
|
@@ -584,7 +484,7 @@ class SnowflakeSqlApiOperator(SQLExecuteQueryOperator):
|
|
|
584
484
|
raise AirflowException(msg)
|
|
585
485
|
elif "status" in event and event["status"] == "success":
|
|
586
486
|
hook = SnowflakeSqlApiHook(snowflake_conn_id=self.snowflake_conn_id)
|
|
587
|
-
query_ids = cast(
|
|
487
|
+
query_ids = cast(list[str], event["statement_query_ids"])
|
|
588
488
|
hook.check_query_output(query_ids)
|
|
589
489
|
self.log.info("%s completed successfully.", self.task_id)
|
|
590
490
|
else:
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import Collection, Mapping, Sequence
|
|
21
|
+
from typing import Any, Callable
|
|
21
22
|
|
|
22
23
|
from airflow.providers.common.compat.standard.operators import PythonOperator, get_current_context
|
|
23
24
|
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
|
-
from
|
|
22
|
+
from collections.abc import Sequence
|
|
23
|
+
from typing import Any
|
|
23
24
|
|
|
24
25
|
from airflow.models import BaseOperator
|
|
25
26
|
from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import asyncio
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import AsyncIterator
|
|
21
|
+
from typing import TYPE_CHECKING, Any
|
|
21
22
|
|
|
22
23
|
from airflow.providers.snowflake.hooks.snowflake_sql_api import SnowflakeSqlApiHook
|
|
23
24
|
from airflow.triggers.base import BaseTrigger, TriggerEvent
|
{apache_airflow_providers_snowflake-5.8.1 → apache_airflow_providers_snowflake-6.0.0}/pyproject.toml
RENAMED
|
@@ -27,7 +27,7 @@ build-backend = "flit_core.buildapi"
|
|
|
27
27
|
|
|
28
28
|
[project]
|
|
29
29
|
name = "apache-airflow-providers-snowflake"
|
|
30
|
-
version = "
|
|
30
|
+
version = "6.0.0"
|
|
31
31
|
description = "Provider package apache-airflow-providers-snowflake for Apache Airflow"
|
|
32
32
|
readme = "README.rst"
|
|
33
33
|
authors = [
|
|
@@ -56,7 +56,7 @@ requires-python = "~=3.9"
|
|
|
56
56
|
dependencies = [
|
|
57
57
|
"apache-airflow-providers-common-compat>=1.1.0",
|
|
58
58
|
"apache-airflow-providers-common-sql>=1.20.0",
|
|
59
|
-
"apache-airflow>=2.
|
|
59
|
+
"apache-airflow>=2.9.0",
|
|
60
60
|
"pandas>=1.5.3,<2.2;python_version<\"3.9\"",
|
|
61
61
|
"pandas>=2.1.2,<2.2;python_version>=\"3.9\"",
|
|
62
62
|
"pyarrow>=14.0.1",
|
|
@@ -66,23 +66,17 @@ dependencies = [
|
|
|
66
66
|
]
|
|
67
67
|
|
|
68
68
|
[project.urls]
|
|
69
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
70
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/
|
|
69
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0"
|
|
70
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.0.0/changelog.html"
|
|
71
71
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
|
72
72
|
"Source Code" = "https://github.com/apache/airflow"
|
|
73
73
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
|
74
|
-
"Twitter" = "https://
|
|
74
|
+
"Twitter" = "https://x.com/ApacheAirflow"
|
|
75
75
|
"YouTube" = "https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/"
|
|
76
76
|
|
|
77
77
|
[project.entry-points."apache_airflow_provider"]
|
|
78
78
|
provider_info = "airflow.providers.snowflake.get_provider_info:get_provider_info"
|
|
79
79
|
[project.optional-dependencies]
|
|
80
|
-
"common.compat" = [
|
|
81
|
-
"apache-airflow-providers-common-compat",
|
|
82
|
-
]
|
|
83
|
-
"common.sql" = [
|
|
84
|
-
"apache-airflow-providers-common-sql",
|
|
85
|
-
]
|
|
86
80
|
"openlineage" = [
|
|
87
81
|
"apache-airflow-providers-openlineage",
|
|
88
82
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|