apache-airflow-providers-openlineage 1.7.0rc1__py3-none-any.whl → 1.7.1rc1__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-openlineage might be problematic. Click here for more details.

@@ -27,7 +27,7 @@ import packaging.version
27
27
 
28
28
  __all__ = ["__version__"]
29
29
 
30
- __version__ = "1.7.0"
30
+ __version__ = "1.7.1"
31
31
 
32
32
  try:
33
33
  from airflow import __version__ as airflow_version
@@ -28,8 +28,9 @@ def get_provider_info():
28
28
  "name": "OpenLineage Airflow",
29
29
  "description": "`OpenLineage <https://openlineage.io/>`__\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1712666247,
31
+ "source-date-epoch": 1714477058,
32
32
  "versions": [
33
+ "1.7.1",
33
34
  "1.7.0",
34
35
  "1.6.0",
35
36
  "1.5.0",
@@ -29,6 +29,7 @@ from openlineage.client.facet import (
29
29
  ExtractionErrorRunFacet,
30
30
  SqlJobFacet,
31
31
  )
32
+ from openlineage.client.run import Dataset
32
33
  from openlineage.common.sql import DbTableMeta, SqlMeta, parse
33
34
 
34
35
  from airflow.providers.openlineage.extractors.base import OperatorLineage
@@ -40,7 +41,6 @@ from airflow.providers.openlineage.utils.sql import (
40
41
  from airflow.typing_compat import TypedDict
41
42
 
42
43
  if TYPE_CHECKING:
43
- from openlineage.client.run import Dataset
44
44
  from sqlalchemy.engine import Engine
45
45
 
46
46
  from airflow.hooks.base import BaseHook
@@ -104,6 +104,18 @@ class DatabaseInfo:
104
104
  normalize_name_method: Callable[[str], str] = default_normalize_name_method
105
105
 
106
106
 
107
+ def from_table_meta(
108
+ table_meta: DbTableMeta, database: str | None, namespace: str, is_uppercase: bool
109
+ ) -> Dataset:
110
+ if table_meta.database:
111
+ name = table_meta.qualified_name
112
+ elif database:
113
+ name = f"{database}.{table_meta.schema}.{table_meta.name}"
114
+ else:
115
+ name = f"{table_meta.schema}.{table_meta.name}"
116
+ return Dataset(namespace=namespace, name=name if not is_uppercase else name.upper())
117
+
118
+
107
119
  class SQLParser:
108
120
  """Interface for openlineage-sql.
109
121
 
@@ -117,7 +129,7 @@ class SQLParser:
117
129
 
118
130
  def parse(self, sql: list[str] | str) -> SqlMeta | None:
119
131
  """Parse a single or a list of SQL statements."""
120
- return parse(sql=sql, dialect=self.dialect)
132
+ return parse(sql=sql, dialect=self.dialect, default_schema=self.default_schema)
121
133
 
122
134
  def parse_table_schemas(
123
135
  self,
@@ -156,6 +168,23 @@ class SQLParser:
156
168
  else None,
157
169
  )
158
170
 
171
+ def get_metadata_from_parser(
172
+ self,
173
+ inputs: list[DbTableMeta],
174
+ outputs: list[DbTableMeta],
175
+ database_info: DatabaseInfo,
176
+ namespace: str = DEFAULT_NAMESPACE,
177
+ database: str | None = None,
178
+ ) -> tuple[list[Dataset], ...]:
179
+ database = database if database else database_info.database
180
+ return [
181
+ from_table_meta(dataset, database, namespace, database_info.is_uppercase_names)
182
+ for dataset in inputs
183
+ ], [
184
+ from_table_meta(dataset, database, namespace, database_info.is_uppercase_names)
185
+ for dataset in outputs
186
+ ]
187
+
159
188
  def attach_column_lineage(
160
189
  self, datasets: list[Dataset], database: str | None, parse_result: SqlMeta
161
190
  ) -> None:
@@ -204,6 +233,7 @@ class SQLParser:
204
233
  database_info: DatabaseInfo,
205
234
  database: str | None = None,
206
235
  sqlalchemy_engine: Engine | None = None,
236
+ use_connection: bool = True,
207
237
  ) -> OperatorLineage:
208
238
  """Parse SQL statement(s) and generate OpenLineage metadata.
209
239
 
@@ -242,15 +272,24 @@ class SQLParser:
242
272
  )
243
273
 
244
274
  namespace = self.create_namespace(database_info=database_info)
245
- inputs, outputs = self.parse_table_schemas(
246
- hook=hook,
247
- inputs=parse_result.in_tables,
248
- outputs=parse_result.out_tables,
249
- namespace=namespace,
250
- database=database,
251
- database_info=database_info,
252
- sqlalchemy_engine=sqlalchemy_engine,
253
- )
275
+ if use_connection:
276
+ inputs, outputs = self.parse_table_schemas(
277
+ hook=hook,
278
+ inputs=parse_result.in_tables,
279
+ outputs=parse_result.out_tables,
280
+ namespace=namespace,
281
+ database=database,
282
+ database_info=database_info,
283
+ sqlalchemy_engine=sqlalchemy_engine,
284
+ )
285
+ else:
286
+ inputs, outputs = self.get_metadata_from_parser(
287
+ inputs=parse_result.in_tables,
288
+ outputs=parse_result.out_tables,
289
+ namespace=namespace,
290
+ database=database,
291
+ database_info=database_info,
292
+ )
254
293
 
255
294
  self.attach_column_lineage(outputs, database or database_info.database, parse_result)
256
295
 
@@ -384,3 +384,8 @@ def normalize_sql(sql: str | Iterable[str]):
384
384
  sql = [stmt for stmt in sql.split(";") if stmt != ""]
385
385
  sql = [obj for stmt in sql for obj in stmt.split(";") if obj != ""]
386
386
  return ";\n".join(sql)
387
+
388
+
389
+ def should_use_external_connection(hook) -> bool:
390
+ # TODO: Add checking overrides
391
+ return hook.__class__.__name__ not in ["SnowflakeHook", "SnowflakeSqlApiHook"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-openlineage
3
- Version: 1.7.0rc1
3
+ Version: 1.7.1rc1
4
4
  Summary: Provider package apache-airflow-providers-openlineage for Apache Airflow
5
5
  Keywords: airflow-provider,openlineage,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -28,8 +28,8 @@ Requires-Dist: openlineage-integration-common>=0.28.0
28
28
  Requires-Dist: openlineage-python>=0.28.0
29
29
  Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
30
30
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
31
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.0/changelog.html
32
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.0
31
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.1/changelog.html
32
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.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
@@ -80,7 +80,7 @@ Provides-Extra: common.sql
80
80
 
81
81
  Package ``apache-airflow-providers-openlineage``
82
82
 
83
- Release: ``1.7.0.rc1``
83
+ Release: ``1.7.1.rc1``
84
84
 
85
85
 
86
86
  `OpenLineage <https://openlineage.io/>`__
@@ -93,7 +93,7 @@ This is a provider package for ``openlineage`` provider. All classes for this pr
93
93
  are in ``airflow.providers.openlineage`` python package.
94
94
 
95
95
  You can find package information and changelog for the provider
96
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.0/>`_.
96
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.1/>`_.
97
97
 
98
98
  Installation
99
99
  ------------
@@ -137,4 +137,4 @@ Dependent package
137
137
  ============================================================================================================ ==============
138
138
 
139
139
  The changelog for the provider package can be found in the
140
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.0/changelog.html>`_.
140
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-openlineage/1.7.1/changelog.html>`_.
@@ -1,8 +1,8 @@
1
1
  airflow/providers/openlineage/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
2
- airflow/providers/openlineage/__init__.py,sha256=YHyXPr7nPtmtaYO8h8zmWWgRa8LAG_mMnyL09Ph6iKs,1586
2
+ airflow/providers/openlineage/__init__.py,sha256=Xc1UFto3ZKaoNfnpJpkK8cxkSAtXxGbxhpZ624JXDko,1586
3
3
  airflow/providers/openlineage/conf.py,sha256=Y76TUM_YwQtn-_081wQicZPTe_8bXH8jNafx-GACgeo,3398
4
- airflow/providers/openlineage/get_provider_info.py,sha256=Cu_1tldNUETXL4SLKOeXiLEo-Yo7pIi0GcvcTxgbYCk,6605
5
- airflow/providers/openlineage/sqlparser.py,sha256=fYHNGaf4kiYJYKVLTqdk-3o7tqckJ-wg3WLhtn0dYLw,13806
4
+ airflow/providers/openlineage/get_provider_info.py,sha256=a_A_2VPU8M2vHZ5CX0_8yUawYEiFieMa3g5tmi3pEnU,6626
5
+ airflow/providers/openlineage/sqlparser.py,sha256=-FGWWK0Xu6XkGSXcfn7PXsWIe0Y0fwe-3hivHg7emLA,15308
6
6
  airflow/providers/openlineage/extractors/__init__.py,sha256=I0X4f6zUniclyD9zT0DFHRImpCpJVP4MkPJT3cd7X5I,1081
7
7
  airflow/providers/openlineage/extractors/base.py,sha256=sj2KS23ocX7LAbkDiR53otkFg1qqEg41PyBivdc-kyM,5070
8
8
  airflow/providers/openlineage/extractors/bash.py,sha256=lE7BH9vipRg9jGloPIE6y6wcHw_BbTvGBasfa4PfDBc,2412
@@ -17,8 +17,8 @@ airflow/providers/openlineage/plugins/openlineage.py,sha256=Owlbpp8puiww-4Wh6B46
17
17
  airflow/providers/openlineage/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
18
18
  airflow/providers/openlineage/utils/selective_enable.py,sha256=JVTmXdQknBL-9N0drFDkVMf1HCf8C6nbITVaP4-5ba4,3072
19
19
  airflow/providers/openlineage/utils/sql.py,sha256=7tEK0zVfIe7v3NI6oyv62x0KAS3sl8Ajfhqob8MdiX8,9366
20
- airflow/providers/openlineage/utils/utils.py,sha256=lONfDxrn30aMy47gZQlDDdLJfvBJgOQE6n0sVuBPd0k,13115
21
- apache_airflow_providers_openlineage-1.7.0rc1.dist-info/entry_points.txt,sha256=GAx0_i2OeZzqaiiiYuA-xchICDXiCT5kVqpKSxsOjt4,214
22
- apache_airflow_providers_openlineage-1.7.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
23
- apache_airflow_providers_openlineage-1.7.0rc1.dist-info/METADATA,sha256=H5CmsWiQxrbCNFvuBBzYmJspl8avkR2OD8QqiMLtBvk,6381
24
- apache_airflow_providers_openlineage-1.7.0rc1.dist-info/RECORD,,
20
+ airflow/providers/openlineage/utils/utils.py,sha256=duT_rXHQuVFUIbMCplGGw0OI0RN0DAXU8oo8FaqcREg,13285
21
+ apache_airflow_providers_openlineage-1.7.1rc1.dist-info/entry_points.txt,sha256=GAx0_i2OeZzqaiiiYuA-xchICDXiCT5kVqpKSxsOjt4,214
22
+ apache_airflow_providers_openlineage-1.7.1rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
23
+ apache_airflow_providers_openlineage-1.7.1rc1.dist-info/METADATA,sha256=5ofVoQHgZeqImH1WQSQuXgyfxHld7oS782eWWbA5n-Q,6381
24
+ apache_airflow_providers_openlineage-1.7.1rc1.dist-info/RECORD,,