apache-airflow-providers-snowflake 5.4.0__py3-none-any.whl → 5.5.0__py3-none-any.whl
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.
- airflow/providers/snowflake/__init__.py +3 -3
- airflow/providers/snowflake/get_provider_info.py +3 -2
- airflow/providers/snowflake/hooks/snowflake.py +6 -18
- airflow/providers/snowflake/hooks/snowflake_sql_api.py +10 -9
- {apache_airflow_providers_snowflake-5.4.0.dist-info → apache_airflow_providers_snowflake-5.5.0.dist-info}/METADATA +8 -8
- {apache_airflow_providers_snowflake-5.4.0.dist-info → apache_airflow_providers_snowflake-5.5.0.dist-info}/RECORD +8 -8
- {apache_airflow_providers_snowflake-5.4.0.dist-info → apache_airflow_providers_snowflake-5.5.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_snowflake-5.4.0.dist-info → apache_airflow_providers_snowflake-5.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -27,7 +27,7 @@ import packaging.version
|
|
|
27
27
|
|
|
28
28
|
__all__ = ["__version__"]
|
|
29
29
|
|
|
30
|
-
__version__ = "5.
|
|
30
|
+
__version__ = "5.5.0"
|
|
31
31
|
|
|
32
32
|
try:
|
|
33
33
|
from airflow import __version__ as airflow_version
|
|
@@ -35,8 +35,8 @@ except ImportError:
|
|
|
35
35
|
from airflow.version import version as airflow_version
|
|
36
36
|
|
|
37
37
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
38
|
-
"2.
|
|
38
|
+
"2.7.0"
|
|
39
39
|
):
|
|
40
40
|
raise RuntimeError(
|
|
41
|
-
f"The package `apache-airflow-providers-snowflake:{__version__}` needs Apache Airflow 2.
|
|
41
|
+
f"The package `apache-airflow-providers-snowflake:{__version__}` needs Apache Airflow 2.7.0+"
|
|
42
42
|
)
|
|
@@ -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": 1714477569,
|
|
32
32
|
"versions": [
|
|
33
|
+
"5.5.0",
|
|
33
34
|
"5.4.0",
|
|
34
35
|
"5.3.1",
|
|
35
36
|
"5.3.0",
|
|
@@ -76,7 +77,7 @@ def get_provider_info():
|
|
|
76
77
|
"1.0.0",
|
|
77
78
|
],
|
|
78
79
|
"dependencies": [
|
|
79
|
-
"apache-airflow>=2.
|
|
80
|
+
"apache-airflow>=2.7.0",
|
|
80
81
|
"apache-airflow-providers-common-sql>=1.10.0",
|
|
81
82
|
"snowflake-connector-python>=2.7.8",
|
|
82
83
|
"snowflake-sqlalchemy>=1.1.0",
|
|
@@ -19,6 +19,7 @@ from __future__ import annotations
|
|
|
19
19
|
|
|
20
20
|
import os
|
|
21
21
|
from contextlib import closing, contextmanager
|
|
22
|
+
from functools import cached_property
|
|
22
23
|
from io import StringIO
|
|
23
24
|
from pathlib import Path
|
|
24
25
|
from typing import TYPE_CHECKING, Any, Callable, Iterable, Mapping, TypeVar, overload
|
|
@@ -177,6 +178,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
177
178
|
return extra_dict[field_name] or None
|
|
178
179
|
return extra_dict.get(backcompat_key) or None
|
|
179
180
|
|
|
181
|
+
@cached_property
|
|
180
182
|
def _get_conn_params(self) -> dict[str, str | None]:
|
|
181
183
|
"""Fetch connection params as a dict.
|
|
182
184
|
|
|
@@ -269,7 +271,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
269
271
|
|
|
270
272
|
def get_uri(self) -> str:
|
|
271
273
|
"""Override DbApiHook get_uri method for get_sqlalchemy_engine()."""
|
|
272
|
-
conn_params = self._get_conn_params
|
|
274
|
+
conn_params = self._get_conn_params
|
|
273
275
|
return self._conn_params_to_sqlalchemy_uri(conn_params)
|
|
274
276
|
|
|
275
277
|
def _conn_params_to_sqlalchemy_uri(self, conn_params: dict) -> str:
|
|
@@ -283,7 +285,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
283
285
|
|
|
284
286
|
def get_conn(self) -> SnowflakeConnection:
|
|
285
287
|
"""Return a snowflake.connection object."""
|
|
286
|
-
conn_config = self._get_conn_params
|
|
288
|
+
conn_config = self._get_conn_params
|
|
287
289
|
conn = connector.connect(**conn_config)
|
|
288
290
|
return conn
|
|
289
291
|
|
|
@@ -294,7 +296,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
294
296
|
:return: the created engine.
|
|
295
297
|
"""
|
|
296
298
|
engine_kwargs = engine_kwargs or {}
|
|
297
|
-
conn_params = self._get_conn_params
|
|
299
|
+
conn_params = self._get_conn_params
|
|
298
300
|
if "insecure_mode" in conn_params:
|
|
299
301
|
engine_kwargs.setdefault("connect_args", {})
|
|
300
302
|
engine_kwargs["connect_args"]["insecure_mode"] = True
|
|
@@ -458,21 +460,7 @@ class SnowflakeHook(DbApiHook):
|
|
|
458
460
|
return "snowflake"
|
|
459
461
|
|
|
460
462
|
def get_openlineage_default_schema(self) -> str | None:
|
|
461
|
-
""
|
|
462
|
-
Attempt to get current schema.
|
|
463
|
-
|
|
464
|
-
Usually ``SELECT CURRENT_SCHEMA();`` should work.
|
|
465
|
-
However, apparently you may set ``database`` without ``schema``
|
|
466
|
-
and get results from ``SELECT CURRENT_SCHEMAS();`` but not
|
|
467
|
-
from ``SELECT CURRENT_SCHEMA();``.
|
|
468
|
-
It still may return nothing if no database is set in connection.
|
|
469
|
-
"""
|
|
470
|
-
schema = self._get_conn_params()["schema"]
|
|
471
|
-
if not schema:
|
|
472
|
-
current_schemas = self.get_first("SELECT PARSE_JSON(CURRENT_SCHEMAS())[0]::string;")[0]
|
|
473
|
-
if current_schemas:
|
|
474
|
-
_, schema = current_schemas.split(".")
|
|
475
|
-
return schema
|
|
463
|
+
return self._get_conn_params["schema"]
|
|
476
464
|
|
|
477
465
|
def _get_openlineage_authority(self, _) -> str:
|
|
478
466
|
from openlineage.common.provider.snowflake import fix_snowflake_sqlalchemy_uri
|
|
@@ -86,7 +86,7 @@ class SnowflakeSqlApiHook(SnowflakeHook):
|
|
|
86
86
|
@property
|
|
87
87
|
def account_identifier(self) -> str:
|
|
88
88
|
"""Returns snowflake account identifier."""
|
|
89
|
-
conn_config = self._get_conn_params
|
|
89
|
+
conn_config = self._get_conn_params
|
|
90
90
|
account_identifier = f"https://{conn_config['account']}"
|
|
91
91
|
|
|
92
92
|
if conn_config["region"]:
|
|
@@ -147,7 +147,7 @@ class SnowflakeSqlApiHook(SnowflakeHook):
|
|
|
147
147
|
When executing the statement, Snowflake replaces placeholders (? and :name) in
|
|
148
148
|
the statement with these specified values.
|
|
149
149
|
"""
|
|
150
|
-
conn_config = self._get_conn_params
|
|
150
|
+
conn_config = self._get_conn_params
|
|
151
151
|
|
|
152
152
|
req_id = uuid.uuid4()
|
|
153
153
|
url = f"{self.account_identifier}.snowflakecomputing.com/api/v2/statements"
|
|
@@ -186,7 +186,7 @@ class SnowflakeSqlApiHook(SnowflakeHook):
|
|
|
186
186
|
|
|
187
187
|
def get_headers(self) -> dict[str, Any]:
|
|
188
188
|
"""Form auth headers based on either OAuth token or JWT token from private key."""
|
|
189
|
-
conn_config = self._get_conn_params
|
|
189
|
+
conn_config = self._get_conn_params
|
|
190
190
|
|
|
191
191
|
# Use OAuth if refresh_token and client_id and client_secret are provided
|
|
192
192
|
if all(
|
|
@@ -225,7 +225,7 @@ class SnowflakeSqlApiHook(SnowflakeHook):
|
|
|
225
225
|
|
|
226
226
|
def get_oauth_token(self) -> str:
|
|
227
227
|
"""Generate temporary OAuth access token using refresh token in connection details."""
|
|
228
|
-
conn_config = self._get_conn_params
|
|
228
|
+
conn_config = self._get_conn_params
|
|
229
229
|
url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request"
|
|
230
230
|
data = {
|
|
231
231
|
"grant_type": "refresh_token",
|
|
@@ -283,11 +283,12 @@ class SnowflakeSqlApiHook(SnowflakeHook):
|
|
|
283
283
|
elif status_code == 422:
|
|
284
284
|
return {"status": "error", "message": resp["message"]}
|
|
285
285
|
elif status_code == 200:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
286
|
+
if resp_statement_handles := resp.get("statementHandles"):
|
|
287
|
+
statement_handles = resp_statement_handles
|
|
288
|
+
elif resp_statement_handle := resp.get("statementHandle"):
|
|
289
|
+
statement_handles = [resp_statement_handle]
|
|
290
|
+
else:
|
|
291
|
+
statement_handles = []
|
|
291
292
|
return {
|
|
292
293
|
"status": "success",
|
|
293
294
|
"message": resp["message"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-airflow-providers-snowflake
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.5.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,14 +22,14 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Topic :: System :: Monitoring
|
|
24
24
|
Requires-Dist: apache-airflow-providers-common-sql>=1.10.0
|
|
25
|
-
Requires-Dist: apache-airflow>=2.
|
|
25
|
+
Requires-Dist: apache-airflow>=2.7.0
|
|
26
26
|
Requires-Dist: snowflake-connector-python>=2.7.8
|
|
27
27
|
Requires-Dist: snowflake-sqlalchemy>=1.1.0
|
|
28
28
|
Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
|
|
29
29
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
30
30
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
31
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.
|
|
32
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.
|
|
31
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0/changelog.html
|
|
32
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0
|
|
33
33
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
34
34
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
35
35
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
@@ -81,7 +81,7 @@ Provides-Extra: openlineage
|
|
|
81
81
|
|
|
82
82
|
Package ``apache-airflow-providers-snowflake``
|
|
83
83
|
|
|
84
|
-
Release: ``5.
|
|
84
|
+
Release: ``5.5.0``
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
`Snowflake <https://www.snowflake.com/>`__
|
|
@@ -94,7 +94,7 @@ This is a provider package for ``snowflake`` provider. All classes for this prov
|
|
|
94
94
|
are in ``airflow.providers.snowflake`` python package.
|
|
95
95
|
|
|
96
96
|
You can find package information and changelog for the provider
|
|
97
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.
|
|
97
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0/>`_.
|
|
98
98
|
|
|
99
99
|
Installation
|
|
100
100
|
------------
|
|
@@ -111,7 +111,7 @@ Requirements
|
|
|
111
111
|
======================================= ==================
|
|
112
112
|
PIP package Version required
|
|
113
113
|
======================================= ==================
|
|
114
|
-
``apache-airflow`` ``>=2.
|
|
114
|
+
``apache-airflow`` ``>=2.7.0``
|
|
115
115
|
``apache-airflow-providers-common-sql`` ``>=1.10.0``
|
|
116
116
|
``snowflake-connector-python`` ``>=2.7.8``
|
|
117
117
|
``snowflake-sqlalchemy`` ``>=1.1.0``
|
|
@@ -138,4 +138,4 @@ Dependent package
|
|
|
138
138
|
============================================================================================================== ===============
|
|
139
139
|
|
|
140
140
|
The changelog for the provider package can be found in the
|
|
141
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.
|
|
141
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0/changelog.html>`_.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
airflow/providers/snowflake/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
|
|
2
|
-
airflow/providers/snowflake/__init__.py,sha256=
|
|
3
|
-
airflow/providers/snowflake/get_provider_info.py,sha256=
|
|
2
|
+
airflow/providers/snowflake/__init__.py,sha256=gB89QMoxD61nY5w2hw9StVEN_gCgvBJWtYcvgNCLSh8,1584
|
|
3
|
+
airflow/providers/snowflake/get_provider_info.py,sha256=9IZEBoYOZs8hnbTQtWRtmddzBp9VUOm8lf5bLWbj7BU,4742
|
|
4
4
|
airflow/providers/snowflake/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
5
|
-
airflow/providers/snowflake/hooks/snowflake.py,sha256=
|
|
6
|
-
airflow/providers/snowflake/hooks/snowflake_sql_api.py,sha256=
|
|
5
|
+
airflow/providers/snowflake/hooks/snowflake.py,sha256=PY3lakFDTSekhdeEwIHF6F8gv0IQyhuH24dSd1hxHsY,20858
|
|
6
|
+
airflow/providers/snowflake/hooks/snowflake_sql_api.py,sha256=ljm6v0CCeej7WyrK3IB6F6p954s5FRgEsocfUCQ83Is,14777
|
|
7
7
|
airflow/providers/snowflake/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
8
8
|
airflow/providers/snowflake/operators/snowflake.py,sha256=Evn8RfBTjLaSqrj7Dkhvu2-ewJoY6miTUFMiTTVd_dA,26383
|
|
9
9
|
airflow/providers/snowflake/transfers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
@@ -13,7 +13,7 @@ airflow/providers/snowflake/triggers/snowflake_trigger.py,sha256=YfMA7IXq3T7voUi
|
|
|
13
13
|
airflow/providers/snowflake/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
14
14
|
airflow/providers/snowflake/utils/common.py,sha256=DG-KLy2KpZWAqZqm_XIECm8lmdoUlzwkXv9onmkQThc,1644
|
|
15
15
|
airflow/providers/snowflake/utils/sql_api_generate_jwt.py,sha256=9mR-vHIquv60tfAni87f6FAjKsiRHUDDrsVhzw4M9vM,6762
|
|
16
|
-
apache_airflow_providers_snowflake-5.
|
|
17
|
-
apache_airflow_providers_snowflake-5.
|
|
18
|
-
apache_airflow_providers_snowflake-5.
|
|
19
|
-
apache_airflow_providers_snowflake-5.
|
|
16
|
+
apache_airflow_providers_snowflake-5.5.0.dist-info/entry_points.txt,sha256=bCrl5J1PXUMzbgnrKYho61rkbL2gHRT4I6f_1jlxAX4,105
|
|
17
|
+
apache_airflow_providers_snowflake-5.5.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
18
|
+
apache_airflow_providers_snowflake-5.5.0.dist-info/METADATA,sha256=8Udk2Cz7NdTtrHLQhKWEEQeVP4txzL3nXpvdEhNo2iM,6508
|
|
19
|
+
apache_airflow_providers_snowflake-5.5.0.dist-info/RECORD,,
|
|
File without changes
|