acryl-datahub-airflow-plugin 1.3.1.5__py3-none-any.whl → 1.3.1.5rc2__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.
- acryl_datahub_airflow_plugin-1.3.1.5rc2.dist-info/METADATA +91 -0
- acryl_datahub_airflow_plugin-1.3.1.5rc2.dist-info/RECORD +33 -0
- datahub_airflow_plugin/_airflow_shims.py +31 -64
- datahub_airflow_plugin/_config.py +19 -97
- datahub_airflow_plugin/_datahub_ol_adapter.py +2 -14
- datahub_airflow_plugin/_extractors.py +365 -0
- datahub_airflow_plugin/_version.py +1 -1
- datahub_airflow_plugin/client/airflow_generator.py +43 -147
- datahub_airflow_plugin/datahub_listener.py +790 -19
- datahub_airflow_plugin/example_dags/__init__.py +0 -32
- datahub_airflow_plugin/example_dags/graph_usage_sample_dag.py +4 -12
- datahub_airflow_plugin/hooks/datahub.py +2 -11
- datahub_airflow_plugin/operators/datahub.py +3 -20
- acryl_datahub_airflow_plugin-1.3.1.5.dist-info/METADATA +0 -303
- acryl_datahub_airflow_plugin-1.3.1.5.dist-info/RECORD +0 -65
- datahub_airflow_plugin/_airflow_compat.py +0 -32
- datahub_airflow_plugin/_airflow_version_specific.py +0 -184
- datahub_airflow_plugin/_constants.py +0 -16
- datahub_airflow_plugin/airflow2/__init__.py +0 -6
- datahub_airflow_plugin/airflow2/_airflow2_sql_parser_patch.py +0 -402
- datahub_airflow_plugin/airflow2/_airflow_compat.py +0 -95
- datahub_airflow_plugin/airflow2/_extractors.py +0 -477
- datahub_airflow_plugin/airflow2/_legacy_shims.py +0 -20
- datahub_airflow_plugin/airflow2/_openlineage_compat.py +0 -123
- datahub_airflow_plugin/airflow2/_provider_shims.py +0 -29
- datahub_airflow_plugin/airflow2/_shims.py +0 -88
- datahub_airflow_plugin/airflow2/datahub_listener.py +0 -1072
- datahub_airflow_plugin/airflow3/__init__.py +0 -6
- datahub_airflow_plugin/airflow3/_airflow3_sql_parser_patch.py +0 -408
- datahub_airflow_plugin/airflow3/_airflow_compat.py +0 -108
- datahub_airflow_plugin/airflow3/_athena_openlineage_patch.py +0 -153
- datahub_airflow_plugin/airflow3/_bigquery_openlineage_patch.py +0 -273
- datahub_airflow_plugin/airflow3/_shims.py +0 -82
- datahub_airflow_plugin/airflow3/_sqlite_openlineage_patch.py +0 -88
- datahub_airflow_plugin/airflow3/_teradata_openlineage_patch.py +0 -308
- datahub_airflow_plugin/airflow3/datahub_listener.py +0 -1452
- datahub_airflow_plugin/example_dags/airflow2/__init__.py +0 -8
- datahub_airflow_plugin/example_dags/airflow2/generic_recipe_sample_dag.py +0 -54
- datahub_airflow_plugin/example_dags/airflow2/graph_usage_sample_dag.py +0 -43
- datahub_airflow_plugin/example_dags/airflow2/lineage_backend_demo.py +0 -69
- datahub_airflow_plugin/example_dags/airflow2/lineage_backend_taskflow_demo.py +0 -69
- datahub_airflow_plugin/example_dags/airflow2/lineage_emission_dag.py +0 -81
- datahub_airflow_plugin/example_dags/airflow2/mysql_sample_dag.py +0 -68
- datahub_airflow_plugin/example_dags/airflow2/snowflake_sample_dag.py +0 -99
- datahub_airflow_plugin/example_dags/airflow3/__init__.py +0 -8
- datahub_airflow_plugin/example_dags/airflow3/lineage_backend_demo.py +0 -51
- datahub_airflow_plugin/example_dags/airflow3/lineage_backend_taskflow_demo.py +0 -51
- datahub_airflow_plugin/example_dags/airflow3/snowflake_sample_dag.py +0 -89
- {acryl_datahub_airflow_plugin-1.3.1.5.dist-info → acryl_datahub_airflow_plugin-1.3.1.5rc2.dist-info}/WHEEL +0 -0
- {acryl_datahub_airflow_plugin-1.3.1.5.dist-info → acryl_datahub_airflow_plugin-1.3.1.5rc2.dist-info}/entry_points.txt +0 -0
- {acryl_datahub_airflow_plugin-1.3.1.5.dist-info → acryl_datahub_airflow_plugin-1.3.1.5rc2.dist-info}/top_level.txt +0 -0
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Compatibility layer for OpenLineage imports in Airflow 2.x.
|
|
3
|
-
|
|
4
|
-
This module handles two different OpenLineage variants that can be used with Airflow 2.x:
|
|
5
|
-
1. Legacy OpenLineage (openlineage-airflow package) - used in Airflow 2.5-2.6
|
|
6
|
-
2. OpenLineage Provider (apache-airflow-providers-openlineage) - used in Airflow 2.7+
|
|
7
|
-
|
|
8
|
-
The module detects which variant is installed and imports the appropriate classes.
|
|
9
|
-
|
|
10
|
-
Note: This file is only used for Airflow 2.x. Airflow 3.x has its own separate module.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
from typing import TYPE_CHECKING, Any
|
|
14
|
-
|
|
15
|
-
if TYPE_CHECKING:
|
|
16
|
-
# For type checking, use proper types based on what's available
|
|
17
|
-
# Try OpenLineage Provider first, fall back to Legacy OpenLineage
|
|
18
|
-
try:
|
|
19
|
-
from airflow.providers.openlineage.extractors.base import (
|
|
20
|
-
BaseExtractor,
|
|
21
|
-
OperatorLineage,
|
|
22
|
-
)
|
|
23
|
-
from airflow.providers.openlineage.extractors.manager import (
|
|
24
|
-
ExtractorManager as OLExtractorManager,
|
|
25
|
-
)
|
|
26
|
-
from airflow.providers.openlineage.extractors.snowflake import (
|
|
27
|
-
SnowflakeExtractor,
|
|
28
|
-
)
|
|
29
|
-
from airflow.providers.openlineage.extractors.sql import SqlExtractor
|
|
30
|
-
from airflow.providers.openlineage.utils.utils import (
|
|
31
|
-
get_operator_class,
|
|
32
|
-
try_import_from_string,
|
|
33
|
-
)
|
|
34
|
-
from openlineage.airflow.extractors import TaskMetadata
|
|
35
|
-
|
|
36
|
-
USE_OPENLINEAGE_PROVIDER: bool = True
|
|
37
|
-
except ImportError:
|
|
38
|
-
# Legacy OpenLineage types
|
|
39
|
-
from openlineage.airflow.extractors import ( # type: ignore[no-redef]
|
|
40
|
-
BaseExtractor,
|
|
41
|
-
ExtractorManager as OLExtractorManager,
|
|
42
|
-
TaskMetadata,
|
|
43
|
-
)
|
|
44
|
-
from openlineage.airflow.extractors.snowflake_extractor import ( # type: ignore[no-redef]
|
|
45
|
-
SnowflakeExtractor,
|
|
46
|
-
)
|
|
47
|
-
from openlineage.airflow.extractors.sql_extractor import (
|
|
48
|
-
SqlExtractor, # type: ignore[no-redef]
|
|
49
|
-
)
|
|
50
|
-
from openlineage.airflow.utils import ( # type: ignore[no-redef]
|
|
51
|
-
get_operator_class,
|
|
52
|
-
try_import_from_string,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
OperatorLineage: Any # type: ignore[no-redef] # Doesn't exist in Legacy OpenLineage
|
|
56
|
-
USE_OPENLINEAGE_PROVIDER: bool = False # type: ignore[no-redef]
|
|
57
|
-
|
|
58
|
-
else:
|
|
59
|
-
# Runtime imports - detect which OpenLineage variant is installed
|
|
60
|
-
USE_OPENLINEAGE_PROVIDER = False
|
|
61
|
-
|
|
62
|
-
try:
|
|
63
|
-
# Try OpenLineage Provider (apache-airflow-providers-openlineage)
|
|
64
|
-
# Available in Airflow 2.7+ when installed with [airflow2-provider] extra
|
|
65
|
-
from airflow.providers.openlineage.extractors.base import (
|
|
66
|
-
BaseExtractor,
|
|
67
|
-
OperatorLineage,
|
|
68
|
-
)
|
|
69
|
-
from airflow.providers.openlineage.extractors.manager import (
|
|
70
|
-
ExtractorManager as OLExtractorManager,
|
|
71
|
-
)
|
|
72
|
-
from airflow.providers.openlineage.utils.utils import (
|
|
73
|
-
get_operator_class,
|
|
74
|
-
try_import_from_string,
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
USE_OPENLINEAGE_PROVIDER = True
|
|
78
|
-
|
|
79
|
-
try:
|
|
80
|
-
from airflow.providers.openlineage.extractors.snowflake import (
|
|
81
|
-
SnowflakeExtractor,
|
|
82
|
-
)
|
|
83
|
-
except ImportError:
|
|
84
|
-
SnowflakeExtractor = None # type: ignore
|
|
85
|
-
|
|
86
|
-
try:
|
|
87
|
-
from airflow.providers.openlineage.extractors.sql import SqlExtractor
|
|
88
|
-
except ImportError:
|
|
89
|
-
SqlExtractor = None # type: ignore
|
|
90
|
-
|
|
91
|
-
# OpenLineage Provider uses OperatorLineage, not TaskMetadata
|
|
92
|
-
TaskMetadata = None # type: ignore
|
|
93
|
-
|
|
94
|
-
except (ImportError, ModuleNotFoundError):
|
|
95
|
-
# Fall back to Legacy OpenLineage (openlineage-airflow package)
|
|
96
|
-
# Used in Airflow 2.5-2.6 or when installed with [airflow2] extra
|
|
97
|
-
from openlineage.airflow.extractors import (
|
|
98
|
-
BaseExtractor,
|
|
99
|
-
ExtractorManager as OLExtractorManager,
|
|
100
|
-
TaskMetadata,
|
|
101
|
-
)
|
|
102
|
-
from openlineage.airflow.extractors.snowflake_extractor import (
|
|
103
|
-
SnowflakeExtractor,
|
|
104
|
-
)
|
|
105
|
-
from openlineage.airflow.extractors.sql_extractor import SqlExtractor
|
|
106
|
-
from openlineage.airflow.utils import get_operator_class, try_import_from_string
|
|
107
|
-
|
|
108
|
-
# Legacy OpenLineage uses TaskMetadata, not OperatorLineage
|
|
109
|
-
OperatorLineage = None # type: ignore
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
# Export all symbols
|
|
113
|
-
__all__ = [
|
|
114
|
-
"USE_OPENLINEAGE_PROVIDER",
|
|
115
|
-
"BaseExtractor",
|
|
116
|
-
"OperatorLineage",
|
|
117
|
-
"TaskMetadata",
|
|
118
|
-
"OLExtractorManager",
|
|
119
|
-
"get_operator_class",
|
|
120
|
-
"try_import_from_string",
|
|
121
|
-
"SnowflakeExtractor",
|
|
122
|
-
"SqlExtractor",
|
|
123
|
-
]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Shims for apache-airflow-providers-openlineage package.
|
|
3
|
-
This module is used when apache-airflow-providers-openlineage is installed
|
|
4
|
-
(Airflow 2.10+ with native OpenLineage provider).
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from airflow.providers.openlineage.plugins.openlineage import (
|
|
8
|
-
OpenLineageProviderPlugin as OpenLineagePlugin,
|
|
9
|
-
)
|
|
10
|
-
from airflow.providers.openlineage.utils.utils import (
|
|
11
|
-
get_operator_class,
|
|
12
|
-
try_import_from_string,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
# Provider package doesn't have TaskHolder - not needed with modern Airflow
|
|
16
|
-
# The task_instance.task attribute is directly available in Airflow 2.10+
|
|
17
|
-
TaskHolder = None # type: ignore[misc,assignment]
|
|
18
|
-
|
|
19
|
-
# Provider package doesn't have redact_with_exclusions - not needed
|
|
20
|
-
# This was only used for logging/debugging in the legacy package
|
|
21
|
-
redact_with_exclusions = None # type: ignore[misc,assignment]
|
|
22
|
-
|
|
23
|
-
__all__ = [
|
|
24
|
-
"TaskHolder",
|
|
25
|
-
"OpenLineagePlugin",
|
|
26
|
-
"get_operator_class",
|
|
27
|
-
"redact_with_exclusions",
|
|
28
|
-
"try_import_from_string",
|
|
29
|
-
]
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Airflow 2.x specific shims and imports.
|
|
3
|
-
Clean, simple imports without cross-version compatibility complexity.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from typing import List
|
|
7
|
-
|
|
8
|
-
from airflow.models.baseoperator import BaseOperator
|
|
9
|
-
|
|
10
|
-
# Operator type alias - try airflow.models.operator.Operator first (Airflow 2.5-2.9)
|
|
11
|
-
# Fall back to BaseOperator for Airflow 2.10+ (transitioning to Airflow 3.x)
|
|
12
|
-
from airflow.models.mappedoperator import MappedOperator
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
from airflow.models.operator import Operator
|
|
16
|
-
except ImportError:
|
|
17
|
-
# Airflow 2.10+ removed airflow.models.operator.Operator
|
|
18
|
-
# Use BaseOperator as the Operator type alias instead
|
|
19
|
-
Operator = BaseOperator # type: ignore[misc]
|
|
20
|
-
|
|
21
|
-
# ExternalTaskSensor import
|
|
22
|
-
try:
|
|
23
|
-
from airflow.sensors.external_task import ExternalTaskSensor
|
|
24
|
-
except ImportError:
|
|
25
|
-
from airflow.sensors.external_task_sensor import ExternalTaskSensor # type: ignore
|
|
26
|
-
|
|
27
|
-
# OpenLineage imports for Airflow 2.x
|
|
28
|
-
# Detect which OpenLineage package is available and load appropriate shims
|
|
29
|
-
_USE_LEGACY_OPENLINEAGE = False
|
|
30
|
-
try:
|
|
31
|
-
# Check if legacy package (openlineage-airflow) is available
|
|
32
|
-
import openlineage.airflow # noqa: F401
|
|
33
|
-
|
|
34
|
-
_USE_LEGACY_OPENLINEAGE = True
|
|
35
|
-
except ImportError:
|
|
36
|
-
pass
|
|
37
|
-
|
|
38
|
-
if _USE_LEGACY_OPENLINEAGE:
|
|
39
|
-
# Import from legacy openlineage-airflow package
|
|
40
|
-
from datahub_airflow_plugin.airflow2._legacy_shims import (
|
|
41
|
-
OpenLineagePlugin,
|
|
42
|
-
TaskHolder,
|
|
43
|
-
get_operator_class,
|
|
44
|
-
redact_with_exclusions,
|
|
45
|
-
try_import_from_string,
|
|
46
|
-
)
|
|
47
|
-
else:
|
|
48
|
-
# Import from native apache-airflow-providers-openlineage package
|
|
49
|
-
from datahub_airflow_plugin.airflow2._provider_shims import (
|
|
50
|
-
OpenLineagePlugin,
|
|
51
|
-
TaskHolder,
|
|
52
|
-
get_operator_class,
|
|
53
|
-
redact_with_exclusions,
|
|
54
|
-
try_import_from_string,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def get_task_inlets(operator: "Operator") -> List:
|
|
59
|
-
"""Get task inlets, handling Airflow 2.x variations."""
|
|
60
|
-
if hasattr(operator, "_inlets"):
|
|
61
|
-
return operator._inlets # type: ignore[attr-defined, union-attr]
|
|
62
|
-
if hasattr(operator, "get_inlet_defs"):
|
|
63
|
-
return operator.get_inlet_defs() # type: ignore[attr-defined]
|
|
64
|
-
return operator.inlets or []
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def get_task_outlets(operator: "Operator") -> List:
|
|
68
|
-
"""Get task outlets, handling Airflow 2.x variations."""
|
|
69
|
-
if hasattr(operator, "_outlets"):
|
|
70
|
-
return operator._outlets # type: ignore[attr-defined, union-attr]
|
|
71
|
-
if hasattr(operator, "get_outlet_defs"):
|
|
72
|
-
return operator.get_outlet_defs()
|
|
73
|
-
return operator.outlets or []
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
__all__ = [
|
|
77
|
-
"BaseOperator",
|
|
78
|
-
"Operator",
|
|
79
|
-
"MappedOperator",
|
|
80
|
-
"ExternalTaskSensor",
|
|
81
|
-
"TaskHolder",
|
|
82
|
-
"OpenLineagePlugin",
|
|
83
|
-
"get_operator_class",
|
|
84
|
-
"try_import_from_string",
|
|
85
|
-
"redact_with_exclusions",
|
|
86
|
-
"get_task_inlets",
|
|
87
|
-
"get_task_outlets",
|
|
88
|
-
]
|