apache-airflow-providers-snowflake 6.3.0rc1__py3-none-any.whl → 6.3.0rc2__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.

@@ -191,7 +191,7 @@ class SnowflakeHook(DbApiHook):
191
191
 
192
192
  @property
193
193
  def account_identifier(self) -> str:
194
- """Returns snowflake account identifier."""
194
+ """Get snowflake account identifier."""
195
195
  conn_config = self._get_conn_params
196
196
  account_identifier = f"https://{conn_config['account']}"
197
197
 
@@ -205,7 +205,7 @@ class SnowflakeHook(DbApiHook):
205
205
  if conn_config is None:
206
206
  conn_config = self._get_conn_params
207
207
 
208
- url = f"{self.account_identifier}.snowflakecomputing.com/oauth/token-request"
208
+ url = f"https://{conn_config['account']}.snowflakecomputing.com/oauth/token-request"
209
209
 
210
210
  data = {
211
211
  "grant_type": "refresh_token",
@@ -97,6 +97,28 @@ def fix_snowflake_sqlalchemy_uri(uri: str) -> str:
97
97
  return urlunparse((parts.scheme, hostname, parts.path, parts.params, parts.query, parts.fragment))
98
98
 
99
99
 
100
+ def _get_logical_date(task_instance):
101
+ # todo: remove when min airflow version >= 3.0
102
+ if AIRFLOW_V_3_0_PLUS:
103
+ dagrun = task_instance.get_template_context()["dag_run"]
104
+ return dagrun.logical_date or dagrun.run_after
105
+
106
+ if hasattr(task_instance, "logical_date"):
107
+ date = task_instance.logical_date
108
+ else:
109
+ date = task_instance.execution_date
110
+
111
+ return date
112
+
113
+
114
+ def _get_dag_run_clear_number(task_instance):
115
+ # todo: remove when min airflow version >= 3.0
116
+ if AIRFLOW_V_3_0_PLUS:
117
+ dagrun = task_instance.get_template_context()["dag_run"]
118
+ return dagrun.clear_number
119
+ return task_instance.dag_run.clear_number
120
+
121
+
100
122
  # todo: move this run_id logic into OpenLineage's listener to avoid differences
101
123
  def _get_ol_run_id(task_instance) -> str:
102
124
  """
@@ -108,29 +130,27 @@ def _get_ol_run_id(task_instance) -> str:
108
130
  """
109
131
  from airflow.providers.openlineage.plugins.adapter import OpenLineageAdapter
110
132
 
111
- def _get_logical_date():
112
- # todo: remove when min airflow version >= 3.0
113
- if AIRFLOW_V_3_0_PLUS:
114
- dagrun = task_instance.get_template_context()["dag_run"]
115
- return dagrun.logical_date or dagrun.run_after
116
-
117
- if hasattr(task_instance, "logical_date"):
118
- date = task_instance.logical_date
119
- else:
120
- date = task_instance.execution_date
121
-
122
- return date
123
-
124
133
  # Generate same OL run id as is generated for current task instance
125
134
  return OpenLineageAdapter.build_task_instance_run_id(
126
135
  dag_id=task_instance.dag_id,
127
136
  task_id=task_instance.task_id,
128
- logical_date=_get_logical_date(),
137
+ logical_date=_get_logical_date(task_instance),
129
138
  try_number=task_instance.try_number,
130
139
  map_index=task_instance.map_index,
131
140
  )
132
141
 
133
142
 
143
+ # todo: move this run_id logic into OpenLineage's listener to avoid differences
144
+ def _get_ol_dag_run_id(task_instance) -> str:
145
+ from airflow.providers.openlineage.plugins.adapter import OpenLineageAdapter
146
+
147
+ return OpenLineageAdapter.build_dag_run_id(
148
+ dag_id=task_instance.dag_id,
149
+ logical_date=_get_logical_date(task_instance),
150
+ clear_number=_get_dag_run_clear_number(task_instance),
151
+ )
152
+
153
+
134
154
  def _get_parent_run_facet(task_instance):
135
155
  """
136
156
  Retrieve the ParentRunFacet associated with a specific Airflow task instance.
@@ -144,6 +164,7 @@ def _get_parent_run_facet(task_instance):
144
164
  from airflow.providers.openlineage.conf import namespace
145
165
 
146
166
  parent_run_id = _get_ol_run_id(task_instance)
167
+ root_parent_run_id = _get_ol_dag_run_id(task_instance)
147
168
 
148
169
  return parent_run.ParentRunFacet(
149
170
  run=parent_run.Run(runId=parent_run_id),
@@ -151,6 +172,13 @@ def _get_parent_run_facet(task_instance):
151
172
  namespace=namespace(),
152
173
  name=f"{task_instance.dag_id}.{task_instance.task_id}",
153
174
  ),
175
+ root=parent_run.Root(
176
+ run=parent_run.RootRun(runId=root_parent_run_id),
177
+ job=parent_run.RootJob(
178
+ name=task_instance.dag_id,
179
+ namespace=namespace(),
180
+ ),
181
+ ),
154
182
  )
155
183
 
156
184
 
@@ -218,7 +246,7 @@ def _create_snowflake_event_pair(
218
246
  return start, end
219
247
 
220
248
 
221
- @require_openlineage_version(provider_min_version="2.0.0")
249
+ @require_openlineage_version(provider_min_version="2.3.0")
222
250
  def emit_openlineage_events_for_snowflake_queries(
223
251
  query_ids: list[str],
224
252
  query_source_namespace: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-snowflake
3
- Version: 6.3.0rc1
3
+ Version: 6.3.0rc2
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>
@@ -28,7 +28,7 @@ Requires-Dist: pyarrow>=14.0.1
28
28
  Requires-Dist: snowflake-connector-python>=3.7.1
29
29
  Requires-Dist: snowflake-sqlalchemy>=1.4.0
30
30
  Requires-Dist: snowflake-snowpark-python>=1.17.0;python_version<'3.12'
31
- Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
31
+ Requires-Dist: apache-airflow-providers-openlineage>=2.3.0rc1 ; extra == "openlineage"
32
32
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
33
33
  Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.3.0/changelog.html
34
34
  Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-snowflake/6.3.0
@@ -5,7 +5,7 @@ airflow/providers/snowflake/version_compat.py,sha256=j5PCtXvZ71aBjixu-EFTNtVDPsn
5
5
  airflow/providers/snowflake/decorators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
6
6
  airflow/providers/snowflake/decorators/snowpark.py,sha256=tKXOjP8m8SEIu0jx2KSrd0n3jGMaIKDOwG2lMkvk3cI,5523
7
7
  airflow/providers/snowflake/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
8
- airflow/providers/snowflake/hooks/snowflake.py,sha256=2dlbnxu-0h1BrlNgdHyXQ69PVeutxijeBUBPNwF8dEg,28022
8
+ airflow/providers/snowflake/hooks/snowflake.py,sha256=9OH16CYnnJ0-ayAg1D7OdZusEf5lSGjQurWifptp97k,28025
9
9
  airflow/providers/snowflake/hooks/snowflake_sql_api.py,sha256=-J0mPcdDc9wbB7DcnZfnXJN7H62nbR_NK5WQJxeKZjE,14532
10
10
  airflow/providers/snowflake/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
11
11
  airflow/providers/snowflake/operators/snowflake.py,sha256=5MisB-bKqUFM9t5Ky913UqewoHlq3k3mCv4bnc-VY7g,22657
@@ -16,10 +16,10 @@ airflow/providers/snowflake/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOF
16
16
  airflow/providers/snowflake/triggers/snowflake_trigger.py,sha256=38tkByMyjbVbSt-69YL8EzRBQT4rhwuOKHgbwHfULL0,4250
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=joZ0ENJXF6I-BQ5EnVeaAYvz2C1Jtp_4pkPvYeJZheI,13510
19
+ airflow/providers/snowflake/utils/openlineage.py,sha256=mgpfWXAzz6EnUS5IsOSyi5_NlorkAaD1jGLpzH9Hs-Y,14483
20
20
  airflow/providers/snowflake/utils/snowpark.py,sha256=9kzWRkdgoNQ8f3Wnr92LdZylMpcpRasxefpOXrM30Cw,1602
21
21
  airflow/providers/snowflake/utils/sql_api_generate_jwt.py,sha256=9mR-vHIquv60tfAni87f6FAjKsiRHUDDrsVhzw4M9vM,6762
22
- apache_airflow_providers_snowflake-6.3.0rc1.dist-info/entry_points.txt,sha256=bCrl5J1PXUMzbgnrKYho61rkbL2gHRT4I6f_1jlxAX4,105
23
- apache_airflow_providers_snowflake-6.3.0rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
- apache_airflow_providers_snowflake-6.3.0rc1.dist-info/METADATA,sha256=7KYZ4V22kQjTg3Mtds9fRGXEq9J-SCPzyg_HjJRYUzs,6218
25
- apache_airflow_providers_snowflake-6.3.0rc1.dist-info/RECORD,,
22
+ apache_airflow_providers_snowflake-6.3.0rc2.dist-info/entry_points.txt,sha256=bCrl5J1PXUMzbgnrKYho61rkbL2gHRT4I6f_1jlxAX4,105
23
+ apache_airflow_providers_snowflake-6.3.0rc2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
24
+ apache_airflow_providers_snowflake-6.3.0rc2.dist-info/METADATA,sha256=saJVx0WY9-LaT8IJZuyof4xuCIpk_B2qJ7LdJVVUEYM,6228
25
+ apache_airflow_providers_snowflake-6.3.0rc2.dist-info/RECORD,,