acryl-datahub-airflow-plugin 1.3.1.4__py3-none-any.whl → 1.3.1.5__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.
Files changed (51) hide show
  1. acryl_datahub_airflow_plugin-1.3.1.5.dist-info/METADATA +303 -0
  2. acryl_datahub_airflow_plugin-1.3.1.5.dist-info/RECORD +65 -0
  3. datahub_airflow_plugin/_airflow_compat.py +32 -0
  4. datahub_airflow_plugin/_airflow_shims.py +64 -31
  5. datahub_airflow_plugin/_airflow_version_specific.py +184 -0
  6. datahub_airflow_plugin/_config.py +97 -19
  7. datahub_airflow_plugin/_constants.py +16 -0
  8. datahub_airflow_plugin/_datahub_ol_adapter.py +14 -2
  9. datahub_airflow_plugin/_version.py +1 -1
  10. datahub_airflow_plugin/airflow2/__init__.py +6 -0
  11. datahub_airflow_plugin/airflow2/_airflow2_sql_parser_patch.py +402 -0
  12. datahub_airflow_plugin/airflow2/_airflow_compat.py +95 -0
  13. datahub_airflow_plugin/airflow2/_extractors.py +477 -0
  14. datahub_airflow_plugin/airflow2/_legacy_shims.py +20 -0
  15. datahub_airflow_plugin/airflow2/_openlineage_compat.py +123 -0
  16. datahub_airflow_plugin/airflow2/_provider_shims.py +29 -0
  17. datahub_airflow_plugin/airflow2/_shims.py +88 -0
  18. datahub_airflow_plugin/airflow2/datahub_listener.py +1072 -0
  19. datahub_airflow_plugin/airflow3/__init__.py +6 -0
  20. datahub_airflow_plugin/airflow3/_airflow3_sql_parser_patch.py +408 -0
  21. datahub_airflow_plugin/airflow3/_airflow_compat.py +108 -0
  22. datahub_airflow_plugin/airflow3/_athena_openlineage_patch.py +153 -0
  23. datahub_airflow_plugin/airflow3/_bigquery_openlineage_patch.py +273 -0
  24. datahub_airflow_plugin/airflow3/_shims.py +82 -0
  25. datahub_airflow_plugin/airflow3/_sqlite_openlineage_patch.py +88 -0
  26. datahub_airflow_plugin/airflow3/_teradata_openlineage_patch.py +308 -0
  27. datahub_airflow_plugin/airflow3/datahub_listener.py +1452 -0
  28. datahub_airflow_plugin/client/airflow_generator.py +147 -43
  29. datahub_airflow_plugin/datahub_listener.py +19 -790
  30. datahub_airflow_plugin/example_dags/__init__.py +32 -0
  31. datahub_airflow_plugin/example_dags/airflow2/__init__.py +8 -0
  32. datahub_airflow_plugin/example_dags/airflow2/generic_recipe_sample_dag.py +54 -0
  33. datahub_airflow_plugin/example_dags/airflow2/graph_usage_sample_dag.py +43 -0
  34. datahub_airflow_plugin/example_dags/airflow2/lineage_backend_demo.py +69 -0
  35. datahub_airflow_plugin/example_dags/airflow2/lineage_backend_taskflow_demo.py +69 -0
  36. datahub_airflow_plugin/example_dags/airflow2/lineage_emission_dag.py +81 -0
  37. datahub_airflow_plugin/example_dags/airflow2/mysql_sample_dag.py +68 -0
  38. datahub_airflow_plugin/example_dags/airflow2/snowflake_sample_dag.py +99 -0
  39. datahub_airflow_plugin/example_dags/airflow3/__init__.py +8 -0
  40. datahub_airflow_plugin/example_dags/airflow3/lineage_backend_demo.py +51 -0
  41. datahub_airflow_plugin/example_dags/airflow3/lineage_backend_taskflow_demo.py +51 -0
  42. datahub_airflow_plugin/example_dags/airflow3/snowflake_sample_dag.py +89 -0
  43. datahub_airflow_plugin/example_dags/graph_usage_sample_dag.py +12 -4
  44. datahub_airflow_plugin/hooks/datahub.py +11 -2
  45. datahub_airflow_plugin/operators/datahub.py +20 -3
  46. acryl_datahub_airflow_plugin-1.3.1.4.dist-info/METADATA +0 -90
  47. acryl_datahub_airflow_plugin-1.3.1.4.dist-info/RECORD +0 -33
  48. datahub_airflow_plugin/_extractors.py +0 -336
  49. {acryl_datahub_airflow_plugin-1.3.1.4.dist-info → acryl_datahub_airflow_plugin-1.3.1.5.dist-info}/WHEEL +0 -0
  50. {acryl_datahub_airflow_plugin-1.3.1.4.dist-info → acryl_datahub_airflow_plugin-1.3.1.5.dist-info}/entry_points.txt +0 -0
  51. {acryl_datahub_airflow_plugin-1.3.1.4.dist-info → acryl_datahub_airflow_plugin-1.3.1.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,88 @@
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
+ ]