apache-airflow-providers-snowflake 6.5.0rc1__py3-none-any.whl → 6.5.1__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.

@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "6.5.0"
32
+ __version__ = "6.5.1"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.10.0"
@@ -253,7 +253,7 @@ class SnowflakeHook(DbApiHook):
253
253
 
254
254
  This is used in ``get_uri()`` and ``get_connection()``.
255
255
  """
256
- conn = self.get_connection(self.snowflake_conn_id) # type: ignore[attr-defined]
256
+ conn = self.get_connection(self.get_conn_id())
257
257
  extra_dict = conn.extra_dejson
258
258
  account = self._get_field(extra_dict, "account") or ""
259
259
  warehouse = self._get_field(extra_dict, "warehouse") or ""
@@ -461,7 +461,7 @@ class SnowflakeHook(DbApiHook):
461
461
  def get_autocommit(self, conn):
462
462
  return getattr(conn, "autocommit_mode", False)
463
463
 
464
- @overload # type: ignore[override]
464
+ @overload
465
465
  def run(
466
466
  self,
467
467
  sql: str | Iterable[str],
@@ -544,16 +544,16 @@ class SnowflakeHook(DbApiHook):
544
544
  results = []
545
545
  for sql_statement in sql_list:
546
546
  self.log.info("Running statement: %s, parameters: %s", sql_statement, parameters)
547
- self._run_command(cur, sql_statement, parameters) # type: ignore[attr-defined]
547
+ self._run_command(cur, sql_statement, parameters)
548
548
 
549
549
  if handler is not None:
550
- result = self._make_common_data_structure(handler(cur)) # type: ignore[attr-defined]
550
+ result = self._make_common_data_structure(handler(cur))
551
551
  if return_single_query_results(sql, return_last, split_statements):
552
552
  _last_result = result
553
553
  _last_description = cur.description
554
554
  else:
555
555
  results.append(result)
556
- self.descriptions.append(cur.description) # type: ignore[has-type]
556
+ self.descriptions.append(cur.description)
557
557
 
558
558
  query_id = cur.sfqid
559
559
  self.log.info("Rows affected: %s", cur.rowcount)
@@ -464,7 +464,7 @@ class SnowflakeSqlApiHook(SnowflakeHook):
464
464
  :return: The response object from the API call.
465
465
  """
466
466
  async with aiohttp.ClientSession(headers=headers) as session:
467
- async for attempt in AsyncRetrying(**self.retry_config): # type: ignore
467
+ async for attempt in AsyncRetrying(**self.retry_config):
468
468
  with attempt:
469
469
  if method.upper() == "GET":
470
470
  async with session.request(method=method.lower(), url=url, params=params) as response:
@@ -427,7 +427,7 @@ class SnowflakeSqlApiOperator(SQLExecuteQueryOperator):
427
427
  """
428
428
  self.log.info("Executing: %s", self.sql)
429
429
  self.query_ids = self._hook.execute_query(
430
- self.sql, # type: ignore[arg-type]
430
+ self.sql,
431
431
  statement_count=self.statement_count,
432
432
  bindings=self.bindings,
433
433
  )
@@ -199,6 +199,7 @@ def _run_single_query_with_hook(hook: SnowflakeHook, sql: str) -> list[dict]:
199
199
  with closing(hook.get_conn()) as conn:
200
200
  hook.set_autocommit(conn, False)
201
201
  with hook._get_cursor(conn, return_dictionaries=True) as cur:
202
+ cur.execute("ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = 3;") # only for this session
202
203
  cur.execute(sql)
203
204
  result = cur.fetchall()
204
205
  conn.commit()
@@ -232,25 +233,36 @@ def _get_queries_details_from_snowflake(
232
233
  if not query_ids:
233
234
  return {}
234
235
  query_condition = f"IN {tuple(query_ids)}" if len(query_ids) > 1 else f"= '{query_ids[0]}'"
236
+ # https://docs.snowflake.com/en/sql-reference/account-usage#differences-between-account-usage-and-information-schema
237
+ # INFORMATION_SCHEMA.QUERY_HISTORY has no latency, so it's better than ACCOUNT_USAGE.QUERY_HISTORY
238
+ # https://docs.snowflake.com/en/sql-reference/functions/query_history
239
+ # SNOWFLAKE.INFORMATION_SCHEMA.QUERY_HISTORY() function seems the most suitable function for the job,
240
+ # we get history of queries executed by the user, and we're using the same credentials.
235
241
  query = (
236
242
  "SELECT "
237
243
  "QUERY_ID, EXECUTION_STATUS, START_TIME, END_TIME, QUERY_TEXT, ERROR_CODE, ERROR_MESSAGE "
238
244
  "FROM "
239
- "table(information_schema.query_history()) "
245
+ "table(snowflake.information_schema.query_history()) "
240
246
  f"WHERE "
241
247
  f"QUERY_ID {query_condition}"
242
248
  f";"
243
249
  )
244
250
 
245
251
  try:
246
- # Can't import the SnowflakeSqlApiHook class and do proper isinstance check - circular imports
247
- if hook.__class__.__name__ == "SnowflakeSqlApiHook":
248
- result = _run_single_query_with_api_hook(hook=hook, sql=query) # type: ignore[arg-type]
252
+ # Note: need to lazy import here to avoid circular imports
253
+ from airflow.providers.snowflake.hooks.snowflake_sql_api import SnowflakeSqlApiHook
254
+
255
+ if isinstance(hook, SnowflakeSqlApiHook):
256
+ result = _run_single_query_with_api_hook(hook=hook, sql=query)
249
257
  result = _process_data_from_api(data=result)
250
258
  else:
251
259
  result = _run_single_query_with_hook(hook=hook, sql=query)
252
260
  except Exception as e:
253
- log.warning("OpenLineage could not retrieve extra metadata from Snowflake. Error encountered: %s", e)
261
+ log.info(
262
+ "OpenLineage encountered an error while retrieving additional metadata about SQL queries"
263
+ " from Snowflake. The process will continue with default values. Error details: %s",
264
+ e,
265
+ )
254
266
  result = []
255
267
 
256
268
  return {row["QUERY_ID"]: row for row in result} if result else {}
@@ -416,8 +428,8 @@ def emit_openlineage_events_for_snowflake_queries(
416
428
  event_batch = _create_snowflake_event_pair(
417
429
  job_namespace=namespace(),
418
430
  job_name=f"{task_instance.dag_id}.{task_instance.task_id}.query.{counter}",
419
- start_time=query_metadata.get("START_TIME", default_event_time), # type: ignore[arg-type]
420
- end_time=query_metadata.get("END_TIME", default_event_time), # type: ignore[arg-type]
431
+ start_time=query_metadata.get("START_TIME", default_event_time),
432
+ end_time=query_metadata.get("END_TIME", default_event_time),
421
433
  # `EXECUTION_STATUS` can be `success`, `fail` or `incident` (Snowflake outage, so still failure)
422
434
  is_successful=query_metadata.get("EXECUTION_STATUS", default_state).lower() == "success",
423
435
  run_facets={**query_specific_run_facets, **common_run_facets, **additional_run_facets},
@@ -37,7 +37,7 @@ AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
37
37
  if AIRFLOW_V_3_0_PLUS:
38
38
  from airflow.sdk import BaseOperator
39
39
  else:
40
- from airflow.models import BaseOperator # type: ignore[no-redef]
40
+ from airflow.models import BaseOperator
41
41
 
42
42
  __all__ = [
43
43
  "AIRFLOW_V_3_0_PLUS",
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-snowflake
3
- Version: 6.5.0rc1
3
+ Version: 6.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>
7
7
  Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
8
- Requires-Python: ~=3.10
8
+ Requires-Python: >=3.10
9
9
  Description-Content-Type: text/x-rst
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
@@ -18,21 +18,23 @@ Classifier: License :: OSI Approved :: Apache Software License
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Classifier: Topic :: System :: Monitoring
22
- Requires-Dist: apache-airflow>=2.10.0rc1
23
- Requires-Dist: apache-airflow-providers-common-compat>=1.6.0rc1
24
- Requires-Dist: apache-airflow-providers-common-sql>=1.21.0rc1
23
+ Requires-Dist: apache-airflow>=2.10.0
24
+ Requires-Dist: apache-airflow-providers-common-compat>=1.6.0
25
+ Requires-Dist: apache-airflow-providers-common-sql>=1.21.0
25
26
  Requires-Dist: pandas>=2.1.2; python_version <"3.13"
26
27
  Requires-Dist: pandas>=2.2.3; python_version >="3.13"
27
- Requires-Dist: pyarrow>=16.1.0
28
+ Requires-Dist: pyarrow>=16.1.0; python_version < '3.13'
29
+ Requires-Dist: pyarrow>=18.0.0; python_version >= '3.13'
28
30
  Requires-Dist: snowflake-connector-python>=3.7.1
29
31
  Requires-Dist: snowflake-sqlalchemy>=1.4.0
30
32
  Requires-Dist: snowflake-snowpark-python>=1.17.0;python_version<'3.12'
31
- Requires-Dist: snowflake-snowpark-python>=1.27.0;python_version>='3.12'
32
- Requires-Dist: apache-airflow-providers-openlineage>=2.3.0rc1 ; extra == "openlineage"
33
+ Requires-Dist: snowflake-snowpark-python>=1.27.0,<9999;python_version>='3.12' and python_version<'3.13'
34
+ Requires-Dist: apache-airflow-providers-openlineage>=2.3.0 ; extra == "openlineage"
33
35
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
34
- Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-snowflake/6.5.0/changelog.html
35
- Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-snowflake/6.5.0
36
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.1/changelog.html
37
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.1
36
38
  Project-URL: Mastodon, https://fosstodon.org/@airflow
37
39
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
38
40
  Project-URL: Source Code, https://github.com/apache/airflow
@@ -64,8 +66,9 @@ Provides-Extra: openlineage
64
66
 
65
67
  Package ``apache-airflow-providers-snowflake``
66
68
 
67
- Release: ``6.5.0``
69
+ Release: ``6.5.1``
68
70
 
71
+ Release Date: ``|PypiReleaseDate|``
69
72
 
70
73
  `Snowflake <https://www.snowflake.com/>`__
71
74
 
@@ -77,7 +80,7 @@ This is a provider package for ``snowflake`` provider. All classes for this prov
77
80
  are in ``airflow.providers.snowflake`` python package.
78
81
 
79
82
  You can find package information and changelog for the provider
80
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.0/>`_.
83
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.1/>`_.
81
84
 
82
85
  Installation
83
86
  ------------
@@ -86,25 +89,26 @@ You can install this package on top of an existing Airflow 2 installation (see `
86
89
  for the minimum Airflow version supported) via
87
90
  ``pip install apache-airflow-providers-snowflake``
88
91
 
89
- The package supports the following python versions: 3.10,3.11,3.12
92
+ The package supports the following python versions: 3.10,3.11,3.12,3.13
90
93
 
91
94
  Requirements
92
95
  ------------
93
96
 
94
- ========================================== ======================================
97
+ ========================================== ========================================================================
95
98
  PIP package Version required
96
- ========================================== ======================================
99
+ ========================================== ========================================================================
97
100
  ``apache-airflow`` ``>=2.10.0``
98
101
  ``apache-airflow-providers-common-compat`` ``>=1.6.0``
99
102
  ``apache-airflow-providers-common-sql`` ``>=1.21.0``
100
103
  ``pandas`` ``>=2.1.2; python_version < "3.13"``
101
104
  ``pandas`` ``>=2.2.3; python_version >= "3.13"``
102
- ``pyarrow`` ``>=16.1.0``
105
+ ``pyarrow`` ``>=16.1.0; python_version < "3.13"``
106
+ ``pyarrow`` ``>=18.0.0; python_version >= "3.13"``
103
107
  ``snowflake-connector-python`` ``>=3.7.1``
104
108
  ``snowflake-sqlalchemy`` ``>=1.4.0``
105
109
  ``snowflake-snowpark-python`` ``>=1.17.0; python_version < "3.12"``
106
- ``snowflake-snowpark-python`` ``>=1.27.0; python_version >= "3.12"``
107
- ========================================== ======================================
110
+ ``snowflake-snowpark-python`` ``>=1.27.0,<9999; python_version >= "3.12" and python_version < "3.13"``
111
+ ========================================== ========================================================================
108
112
 
109
113
  Cross provider package dependencies
110
114
  -----------------------------------
@@ -128,5 +132,5 @@ Dependent package
128
132
  ================================================================================================================== =================
129
133
 
130
134
  The changelog for the provider package can be found in the
131
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.0/changelog.html>`_.
135
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.5.1/changelog.html>`_.
132
136
 
@@ -1,14 +1,14 @@
1
1
  airflow/providers/snowflake/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/snowflake/__init__.py,sha256=adBe6ltW-rLtYQFNU8hpf6foAV8Pe60l_xFgAkGQCBg,1498
2
+ airflow/providers/snowflake/__init__.py,sha256=PLl9W_p55fb50lyknoowsglqbk6s2SE4Y8zXCAUTovw,1498
3
3
  airflow/providers/snowflake/get_provider_info.py,sha256=NdNRMfulBbpD-I4yFRr8U533m9djD18ijEMvuxOp4_g,3875
4
- airflow/providers/snowflake/version_compat.py,sha256=IlaClFJYi0uPxuC8cJt0Ro3Kl3tjIGc31ALoKDQbw5Q,1738
4
+ airflow/providers/snowflake/version_compat.py,sha256=7RHBehpYMeNSBtmJiPUeJHA0c7l-Eqsdy546kW3RFa4,1712
5
5
  airflow/providers/snowflake/decorators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
6
  airflow/providers/snowflake/decorators/snowpark.py,sha256=5ocPY8wrXvKbZJokefV4HDfX0WXzrHmcekXoZjkfHEw,5523
7
7
  airflow/providers/snowflake/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
- airflow/providers/snowflake/hooks/snowflake.py,sha256=RUWO9j_gd26BbktGzavxvgihCbOaBTNKlxyDvTxIBig,28502
9
- airflow/providers/snowflake/hooks/snowflake_sql_api.py,sha256=bCY3lSar-k3XjiDnrrWVRWTRunJL6U0Kss7fCLxFqTM,22287
8
+ airflow/providers/snowflake/hooks/snowflake.py,sha256=PhypqxeK6HZBlAKKkghRjIqCKFRkaWrkgA9yfcBB26I,28356
9
+ airflow/providers/snowflake/hooks/snowflake_sql_api.py,sha256=WFmz9qJ1YwEPXH7CsbH1XnHYS-feKQjKyHW9hHifEvo,22271
10
10
  airflow/providers/snowflake/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
11
- airflow/providers/snowflake/operators/snowflake.py,sha256=Xfz_bv1Y0M8IWv67dOXcupeYWYlG91kPVgCe_vEqntY,23253
11
+ airflow/providers/snowflake/operators/snowflake.py,sha256=wMGvXzfXLABtUhSVK4Som5MAI-6NsmG0VY1hRUV00Wo,23227
12
12
  airflow/providers/snowflake/operators/snowpark.py,sha256=Tfd31My6arGXKo0yfi46HyVfkHO3yeT085l3ymxtGpk,5815
13
13
  airflow/providers/snowflake/transfers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
14
14
  airflow/providers/snowflake/transfers/copy_into_snowflake.py,sha256=2WQDhD9U1l38ZoIv7FImsV6S3gT_rSisg_isNi4k08E,13618
@@ -16,10 +16,10 @@ airflow/providers/snowflake/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOF
16
16
  airflow/providers/snowflake/triggers/snowflake_trigger.py,sha256=QXNLijmtZI7NIdPtOwbvS-4ohgrm8RV_jaBKvekosHQ,4051
17
17
  airflow/providers/snowflake/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
18
18
  airflow/providers/snowflake/utils/common.py,sha256=DG-KLy2KpZWAqZqm_XIECm8lmdoUlzwkXv9onmkQThc,1644
19
- airflow/providers/snowflake/utils/openlineage.py,sha256=5qpLU7D9EFolXGWEKI90py45iU0OPNyUEim7_Y7a2yw,18686
19
+ airflow/providers/snowflake/utils/openlineage.py,sha256=JdGHyiNBhd7qsNw4OROF5sW3PlFLH_JrSBReGhuxmkk,19396
20
20
  airflow/providers/snowflake/utils/snowpark.py,sha256=-S6ltYiW-KooqUMGzY0OebmAzpUAu7GIjFWwuYERuk8,1629
21
21
  airflow/providers/snowflake/utils/sql_api_generate_jwt.py,sha256=9mR-vHIquv60tfAni87f6FAjKsiRHUDDrsVhzw4M9vM,6762
22
- apache_airflow_providers_snowflake-6.5.0rc1.dist-info/entry_points.txt,sha256=bCrl5J1PXUMzbgnrKYho61rkbL2gHRT4I6f_1jlxAX4,105
23
- apache_airflow_providers_snowflake-6.5.0rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
- apache_airflow_providers_snowflake-6.5.0rc1.dist-info/METADATA,sha256=i3-l5gSqKajwJE54Yr6sbqERh3r8mXiNHfuzHB8T9R0,6522
25
- apache_airflow_providers_snowflake-6.5.0rc1.dist-info/RECORD,,
22
+ apache_airflow_providers_snowflake-6.5.1.dist-info/entry_points.txt,sha256=bCrl5J1PXUMzbgnrKYho61rkbL2gHRT4I6f_1jlxAX4,105
23
+ apache_airflow_providers_snowflake-6.5.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
+ apache_airflow_providers_snowflake-6.5.1.dist-info/METADATA,sha256=8wAREY5dxTbVE8mAP7wdwLxNepObZhCbAhPWL_2zd6Y,6943
25
+ apache_airflow_providers_snowflake-6.5.1.dist-info/RECORD,,