apache-airflow-providers-snowflake 5.5.0rc1__tar.gz → 5.5.1__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.
Files changed (19) hide show
  1. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/PKG-INFO +8 -8
  2. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/README.rst +3 -3
  3. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/__init__.py +3 -6
  4. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/get_provider_info.py +2 -1
  5. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/hooks/snowflake.py +2 -3
  6. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/transfers/copy_into_snowflake.py +0 -2
  7. apache_airflow_providers_snowflake-5.5.1/airflow/providers/snowflake/utils/openlineage.py +63 -0
  8. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/pyproject.toml +5 -5
  9. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/LICENSE +0 -0
  10. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/hooks/__init__.py +0 -0
  11. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/hooks/snowflake_sql_api.py +0 -0
  12. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/operators/__init__.py +0 -0
  13. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/operators/snowflake.py +0 -0
  14. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/transfers/__init__.py +0 -0
  15. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/triggers/__init__.py +0 -0
  16. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/triggers/snowflake_trigger.py +0 -0
  17. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/utils/__init__.py +0 -0
  18. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/utils/common.py +0 -0
  19. {apache_airflow_providers_snowflake-5.5.0rc1 → apache_airflow_providers_snowflake-5.5.1}/airflow/providers/snowflake/utils/sql_api_generate_jwt.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-snowflake
3
- Version: 5.5.0rc1
3
+ Version: 5.5.1
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>
@@ -21,15 +21,15 @@ Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
23
  Classifier: Topic :: System :: Monitoring
24
- Requires-Dist: apache-airflow-providers-common-sql>=1.10.0rc0
25
- Requires-Dist: apache-airflow>=2.7.0rc0
24
+ Requires-Dist: apache-airflow-providers-common-sql>=1.10.0
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.5.0/changelog.html
32
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0
31
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/changelog.html
32
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1
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.5.0.rc1``
84
+ Release: ``5.5.1``
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.5.0/>`_.
97
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/>`_.
98
98
 
99
99
  Installation
100
100
  ------------
@@ -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.5.0/changelog.html>`_.
141
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/changelog.html>`_.
@@ -42,7 +42,7 @@
42
42
 
43
43
  Package ``apache-airflow-providers-snowflake``
44
44
 
45
- Release: ``5.5.0.rc1``
45
+ Release: ``5.5.1``
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/5.5.0/>`_.
58
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/>`_.
59
59
 
60
60
  Installation
61
61
  ------------
@@ -99,4 +99,4 @@ Dependent package
99
99
  ============================================================================================================== ===============
100
100
 
101
101
  The changelog for the provider package can be found in the
102
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0/changelog.html>`_.
102
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/changelog.html>`_.
@@ -25,14 +25,11 @@ from __future__ import annotations
25
25
 
26
26
  import packaging.version
27
27
 
28
- __all__ = ["__version__"]
28
+ from airflow import __version__ as airflow_version
29
29
 
30
- __version__ = "5.5.0"
30
+ __all__ = ["__version__"]
31
31
 
32
- try:
33
- from airflow import __version__ as airflow_version
34
- except ImportError:
35
- from airflow.version import version as airflow_version
32
+ __version__ = "5.5.1"
36
33
 
37
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
38
35
  "2.7.0"
@@ -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": 1714477569,
31
+ "source-date-epoch": 1716289119,
32
32
  "versions": [
33
+ "5.5.1",
33
34
  "5.5.0",
34
35
  "5.4.0",
35
36
  "5.3.1",
@@ -34,6 +34,7 @@ from sqlalchemy import create_engine
34
34
 
35
35
  from airflow.exceptions import AirflowException
36
36
  from airflow.providers.common.sql.hooks.sql import DbApiHook, return_single_query_results
37
+ from airflow.providers.snowflake.utils.openlineage import fix_snowflake_sqlalchemy_uri
37
38
  from airflow.utils.strings import to_boolean
38
39
 
39
40
  T = TypeVar("T")
@@ -462,9 +463,7 @@ class SnowflakeHook(DbApiHook):
462
463
  def get_openlineage_default_schema(self) -> str | None:
463
464
  return self._get_conn_params["schema"]
464
465
 
465
- def _get_openlineage_authority(self, _) -> str:
466
- from openlineage.common.provider.snowflake import fix_snowflake_sqlalchemy_uri
467
-
466
+ def _get_openlineage_authority(self, _) -> str | None:
468
467
  uri = fix_snowflake_sqlalchemy_uri(self.get_uri())
469
468
  return urlparse(uri).hostname
470
469
 
@@ -42,8 +42,6 @@ class CopyFromExternalStageToSnowflakeOperator(BaseOperator):
42
42
  :param prefix: cloud storage location specified to limit the set of files to load
43
43
  :param files: files to load into table
44
44
  :param pattern: pattern to load files from external location to table
45
- :param copy_into_postifx: optional sql postfix for INSERT INTO query
46
- such as `formatTypeOptions` and `copyOptions`
47
45
  :param snowflake_conn_id: Reference to :ref:`Snowflake connection id<howto/connection:snowflake>`
48
46
  :param account: snowflake account name
49
47
  :param warehouse: name of snowflake warehouse
@@ -0,0 +1,63 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ from __future__ import annotations
18
+
19
+ from urllib.parse import quote, urlparse, urlunparse
20
+
21
+
22
+ def fix_account_name(name: str) -> str:
23
+ """Fix account name to have the following format: <account_id>.<region>.<cloud>."""
24
+ spl = name.split(".")
25
+ if len(spl) == 1:
26
+ account = spl[0]
27
+ region, cloud = "us-west-1", "aws"
28
+ elif len(spl) == 2:
29
+ account, region = spl
30
+ cloud = "aws"
31
+ else:
32
+ account, region, cloud = spl
33
+ return f"{account}.{region}.{cloud}"
34
+
35
+
36
+ def fix_snowflake_sqlalchemy_uri(uri: str) -> str:
37
+ """Fix snowflake sqlalchemy connection URI to OpenLineage structure.
38
+
39
+ Snowflake sqlalchemy connection URI has following structure:
40
+ 'snowflake://<user_login_name>:<password>@<account_identifier>/<database_name>/<schema_name>?warehouse=<warehouse_name>&role=<role_name>'
41
+ We want account identifier normalized. It can have two forms:
42
+ - newer, in form of <organization>-<id>. In this case we want to do nothing.
43
+ - older, composed of <id>-<region>-<cloud> where region and cloud can be
44
+ optional in some cases. If <cloud> is omitted, it's AWS.
45
+ If region and cloud are omitted, it's AWS us-west-1
46
+ """
47
+ try:
48
+ parts = urlparse(uri)
49
+ except ValueError:
50
+ # snowflake.sqlalchemy.URL does not quote `[` and `]`
51
+ # that's a rare case so we can run more debugging code here
52
+ # to make sure we replace only password
53
+ parts = urlparse(uri.replace("[", quote("[")).replace("]", quote("]")))
54
+
55
+ hostname = parts.hostname
56
+ if not hostname:
57
+ return uri
58
+
59
+ # old account identifier like xy123456
60
+ if "." in hostname or not any(word in hostname for word in ["-", "_"]):
61
+ hostname = fix_account_name(hostname)
62
+ # else - its new hostname, just return it
63
+ return urlunparse((parts.scheme, hostname, parts.path, parts.params, parts.query, parts.fragment))
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
28
28
 
29
29
  [project]
30
30
  name = "apache-airflow-providers-snowflake"
31
- version = "5.5.0.rc1"
31
+ version = "5.5.1"
32
32
  description = "Provider package apache-airflow-providers-snowflake for Apache Airflow"
33
33
  readme = "README.rst"
34
34
  authors = [
@@ -56,15 +56,15 @@ classifiers = [
56
56
  ]
57
57
  requires-python = "~=3.8"
58
58
  dependencies = [
59
- "apache-airflow-providers-common-sql>=1.10.0rc0",
60
- "apache-airflow>=2.7.0rc0",
59
+ "apache-airflow-providers-common-sql>=1.10.0",
60
+ "apache-airflow>=2.7.0",
61
61
  "snowflake-connector-python>=2.7.8",
62
62
  "snowflake-sqlalchemy>=1.1.0",
63
63
  ]
64
64
 
65
65
  [project.urls]
66
- "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0"
67
- "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.0/changelog.html"
66
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1"
67
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-snowflake/5.5.1/changelog.html"
68
68
  "Bug Tracker" = "https://github.com/apache/airflow/issues"
69
69
  "Source Code" = "https://github.com/apache/airflow"
70
70
  "Slack Chat" = "https://s.apache.org/airflow-slack"