apache-airflow-providers-databricks 7.7.1rc1__py3-none-any.whl → 7.7.2rc1__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.
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "7.7.1"
32
+ __version__ = "7.7.2"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "2.10.0"
@@ -298,6 +298,16 @@ class DatabricksHook(BaseDatabricksHook):
298
298
 
299
299
  :param json: The data used in the new_settings of the request to the ``reset`` endpoint.
300
300
  """
301
+ access_control_list = json.get("access_control_list", None)
302
+ if access_control_list:
303
+ self.log.info(
304
+ "Updating job permission for Databricks workflow job id %s with access_control_list %s",
305
+ job_id,
306
+ access_control_list,
307
+ )
308
+ acl_json = {"access_control_list": access_control_list}
309
+ self.update_job_permission(job_id=int(job_id), json=acl_json)
310
+
301
311
  self._do_api_call(RESET_ENDPOINT, {"job_id": job_id, "new_settings": json})
302
312
 
303
313
  def update_job(self, job_id: str, json: dict) -> None:
@@ -179,7 +179,6 @@ class DatabricksSqlHook(BaseDatabricksHook, DbApiHook):
179
179
 
180
180
  :return: the extracted sqlalchemy.engine.URL object.
181
181
  """
182
- conn = self.get_conn()
183
182
  url_query = {
184
183
  "http_path": self._http_path,
185
184
  "catalog": self.catalog,
@@ -189,9 +188,8 @@ class DatabricksSqlHook(BaseDatabricksHook, DbApiHook):
189
188
  return URL.create(
190
189
  drivername="databricks",
191
190
  username="token",
192
- password=conn.password,
193
- host=conn.host,
194
- port=conn.port,
191
+ password=self._get_token(raise_error=True),
192
+ host=self.host,
195
193
  query=url_query,
196
194
  )
197
195
 
@@ -398,10 +398,6 @@ class DatabricksCreateJobsOperator(BaseOperator):
398
398
  if job_id is None:
399
399
  return self._hook.create_job(self.json)
400
400
  self._hook.reset_job(str(job_id), self.json)
401
- if (access_control_list := self.json.get("access_control_list")) is not None:
402
- acl_json = {"access_control_list": access_control_list}
403
- self._hook.update_job_permission(job_id, normalise_json_content(acl_json))
404
-
405
401
  return job_id
406
402
 
407
403
 
@@ -27,10 +27,8 @@ from flask_appbuilder import BaseView
27
27
  from flask_appbuilder.api import expose
28
28
 
29
29
  from airflow.exceptions import AirflowException, TaskInstanceNotFound
30
- from airflow.models import DagBag
31
- from airflow.models.dag import DAG, clear_task_instances
32
30
  from airflow.models.dagrun import DagRun
33
- from airflow.models.taskinstance import TaskInstance, TaskInstanceKey
31
+ from airflow.models.taskinstance import TaskInstance, TaskInstanceKey, clear_task_instances
34
32
  from airflow.plugins_manager import AirflowPlugin
35
33
  from airflow.providers.databricks.hooks.databricks import DatabricksHook
36
34
  from airflow.providers.databricks.version_compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink, TaskGroup, XCom
@@ -90,8 +88,15 @@ def get_databricks_task_ids(
90
88
  if not AIRFLOW_V_3_0_PLUS:
91
89
  from airflow.utils.session import NEW_SESSION, provide_session
92
90
 
93
- @provide_session
94
- def _get_dagrun(dag: DAG, run_id: str, session: Session | None = None) -> DagRun:
91
+ def _get_dag(dag_id: str, session: Session):
92
+ from airflow.models.serialized_dag import SerializedDagModel
93
+
94
+ dag = SerializedDagModel.get_dag(dag_id, session=session)
95
+ if not dag:
96
+ raise AirflowException("Dag not found.")
97
+ return dag
98
+
99
+ def _get_dagrun(dag, run_id: str, session: Session) -> DagRun:
95
100
  """
96
101
  Retrieve the DagRun object associated with the specified DAG and run_id.
97
102
 
@@ -107,10 +112,9 @@ if not AIRFLOW_V_3_0_PLUS:
107
112
 
108
113
  @provide_session
109
114
  def _clear_task_instances(
110
- dag_id: str, run_id: str, task_ids: list[str], log: logging.Logger, session: Session | None = None
115
+ dag_id: str, run_id: str, task_ids: list[str], log: logging.Logger, session: Session = NEW_SESSION
111
116
  ) -> None:
112
- dag_bag = DagBag(read_dags_from_db=True)
113
- dag = dag_bag.get_dag(dag_id)
117
+ dag = _get_dag(dag_id, session=session)
114
118
  log.debug("task_ids %s to clear", str(task_ids))
115
119
  dr: DagRun = _get_dagrun(dag, run_id, session=session)
116
120
  tis_to_clear = [ti for ti in dr.get_task_instances() if ti.databricks_task_key in task_ids]
@@ -274,13 +278,8 @@ class WorkflowJobRunLink(BaseOperatorLink, LoggingMixin):
274
278
  ti = get_task_instance(operator, dttm)
275
279
  ti_key = ti.key
276
280
  task_group = operator.task_group
277
-
278
281
  if not task_group:
279
282
  raise AirflowException("Task group is required for generating Databricks Workflow Job Run Link.")
280
-
281
- dag_bag = DagBag(read_dags_from_db=True)
282
- dag = dag_bag.get_dag(ti_key.dag_id)
283
- dag.get_task(ti_key.task_id)
284
283
  self.log.info("Getting link for task %s", ti_key.task_id)
285
284
  if ".launch" not in ti_key.task_id:
286
285
  self.log.debug("Finding the launch task for job run metadata %s", ti_key.task_id)
@@ -375,9 +374,12 @@ class WorkflowJobRepairAllFailedLink(BaseOperatorLink, LoggingMixin):
375
374
  raise AirflowException("Task group is required for generating repair link.")
376
375
  if not task_group.group_id:
377
376
  raise AirflowException("Task group ID is required for generating repair link.")
378
- dag_bag = DagBag(read_dags_from_db=True)
379
- dag = dag_bag.get_dag(ti_key.dag_id)
380
- dr = _get_dagrun(dag, ti_key.run_id)
377
+
378
+ from airflow.utils.session import create_session
379
+
380
+ with create_session() as session:
381
+ dag = _get_dag(ti_key.dag_id, session=session)
382
+ dr = _get_dagrun(dag, ti_key.run_id, session=session)
381
383
  log.debug("Getting failed and skipped tasks for dag run %s", dr.run_id)
382
384
  task_group_sub_tasks = self.get_task_group_children(task_group).items()
383
385
  failed_and_skipped_tasks = self._get_failed_and_skipped_tasks(dr)
@@ -435,9 +437,14 @@ class WorkflowJobRepairSingleTaskLink(BaseOperatorLink, LoggingMixin):
435
437
  task_group.group_id,
436
438
  ti_key.task_id,
437
439
  )
438
- dag_bag = DagBag(read_dags_from_db=True)
439
- dag = dag_bag.get_dag(ti_key.dag_id)
440
+
441
+ from airflow.utils.session import create_session
442
+
443
+ with create_session() as session:
444
+ dag = _get_dag(ti_key.dag_id, session=session)
440
445
  task = dag.get_task(ti_key.task_id)
446
+ if TYPE_CHECKING:
447
+ assert isinstance(task, DatabricksTaskBaseOperator)
441
448
 
442
449
  if ".launch" not in ti_key.task_id:
443
450
  launch_task_id = get_launch_task_id(task_group)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-databricks
3
- Version: 7.7.1rc1
3
+ Version: 7.7.2rc1
4
4
  Summary: Provider package apache-airflow-providers-databricks for Apache Airflow
5
5
  Keywords: airflow-provider,databricks,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -23,7 +23,6 @@ Classifier: Topic :: System :: Monitoring
23
23
  Requires-Dist: apache-airflow>=2.10.0rc1
24
24
  Requires-Dist: apache-airflow-providers-common-compat>=1.6.0rc1
25
25
  Requires-Dist: apache-airflow-providers-common-sql>=1.27.0rc1
26
- Requires-Dist: apache-airflow-providers-openlineage>=2.3.0rc1
27
26
  Requires-Dist: requests>=2.32.0,<3
28
27
  Requires-Dist: databricks-sql-connector>=4.0.0
29
28
  Requires-Dist: databricks-sqlalchemy>=1.0.2
@@ -35,17 +34,19 @@ Requires-Dist: pyarrow>=16.1.0; python_version < '3.13'
35
34
  Requires-Dist: pyarrow>=18.0.0; python_version >= '3.13'
36
35
  Requires-Dist: azure-identity>=1.3.1 ; extra == "azure-identity"
37
36
  Requires-Dist: apache-airflow-providers-fab>=2.2.0rc1 ; extra == "fab" and ( python_version < '3.13')
37
+ Requires-Dist: apache-airflow-providers-openlineage>=2.3.0rc1 ; extra == "openlineage"
38
38
  Requires-Dist: databricks-sdk==0.10.0 ; extra == "sdk"
39
39
  Requires-Dist: apache-airflow-providers-standard ; extra == "standard"
40
40
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
41
- Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-databricks/7.7.1/changelog.html
42
- Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-databricks/7.7.1
41
+ Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-databricks/7.7.2/changelog.html
42
+ Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-databricks/7.7.2
43
43
  Project-URL: Mastodon, https://fosstodon.org/@airflow
44
44
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
45
45
  Project-URL: Source Code, https://github.com/apache/airflow
46
46
  Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
47
47
  Provides-Extra: azure-identity
48
48
  Provides-Extra: fab
49
+ Provides-Extra: openlineage
49
50
  Provides-Extra: sdk
50
51
  Provides-Extra: standard
51
52
 
@@ -74,9 +75,8 @@ Provides-Extra: standard
74
75
 
75
76
  Package ``apache-airflow-providers-databricks``
76
77
 
77
- Release: ``7.7.1``
78
+ Release: ``7.7.2``
78
79
 
79
- Release Date: ``|PypiReleaseDate|``
80
80
 
81
81
  `Databricks <https://databricks.com/>`__
82
82
 
@@ -88,12 +88,12 @@ This is a provider package for ``databricks`` provider. All classes for this pro
88
88
  are in ``airflow.providers.databricks`` python package.
89
89
 
90
90
  You can find package information and changelog for the provider
91
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-databricks/7.7.1/>`_.
91
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-databricks/7.7.2/>`_.
92
92
 
93
93
  Installation
94
94
  ------------
95
95
 
96
- You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
96
+ You can install this package on top of an existing Airflow installation (see ``Requirements`` below
97
97
  for the minimum Airflow version supported) via
98
98
  ``pip install apache-airflow-providers-databricks``
99
99
 
@@ -108,7 +108,6 @@ PIP package Version required
108
108
  ``apache-airflow`` ``>=2.10.0``
109
109
  ``apache-airflow-providers-common-compat`` ``>=1.6.0``
110
110
  ``apache-airflow-providers-common-sql`` ``>=1.27.0``
111
- ``apache-airflow-providers-openlineage`` ``>=2.3.0``
112
111
  ``requests`` ``>=2.32.0,<3``
113
112
  ``databricks-sql-connector`` ``>=4.0.0``
114
113
  ``databricks-sqlalchemy`` ``>=1.0.2``
@@ -143,5 +142,5 @@ Dependent package
143
142
  ================================================================================================================== =================
144
143
 
145
144
  The changelog for the provider package can be found in the
146
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-databricks/7.7.1/changelog.html>`_.
145
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-databricks/7.7.2/changelog.html>`_.
147
146
 
@@ -1,19 +1,19 @@
1
1
  airflow/providers/databricks/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/databricks/__init__.py,sha256=zXiLv28riX2qlvDCrFKrkwUuY5dP9yLF209glzp2_AU,1499
2
+ airflow/providers/databricks/__init__.py,sha256=lYfw4I2LzZTvalJKs-1qVwu0Om8gcTtnYtiRZlSo30A,1499
3
3
  airflow/providers/databricks/exceptions.py,sha256=85RklmLOI_PnTzfXNIUd5fAu2aMMUhelwumQAX0wANE,1261
4
4
  airflow/providers/databricks/get_provider_info.py,sha256=NZ-rY6k6ctDZN7rDngN7mAzq7RMhLag5NwfnuBNcKuw,5644
5
5
  airflow/providers/databricks/version_compat.py,sha256=FPgvVwIHRDhFFg0Ghd4WfCiQt-lI8DXtgv4bHwu7Wx4,2021
6
6
  airflow/providers/databricks/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
7
- airflow/providers/databricks/hooks/databricks.py,sha256=-Mrgig6XXQ1Uzk_0gfPlxu93N6aNkfdPiugGTvZfndg,29020
7
+ airflow/providers/databricks/hooks/databricks.py,sha256=rkd1J73Zc8IRnMBapxRHWUvyNAEVyV5j14iBDtRdzFo,29470
8
8
  airflow/providers/databricks/hooks/databricks_base.py,sha256=gish0H2rHEzPqI5ZpU3BPFCUaycHMEYGYev0ufJMzzI,35167
9
- airflow/providers/databricks/hooks/databricks_sql.py,sha256=x-Wgmass2IQRm7wXAqMCmZNUvtb2GAM9_4VTla_fBV4,17765
9
+ airflow/providers/databricks/hooks/databricks_sql.py,sha256=-oGJxteTW1L7L0MLpiNeucWs3q_k2n0Ax2rLSNGc0F8,17726
10
10
  airflow/providers/databricks/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
11
- airflow/providers/databricks/operators/databricks.py,sha256=6T5T2YdfX9tKkDZ--5WiiYh08rGPzVaRibpCQAuyvzw,79884
11
+ airflow/providers/databricks/operators/databricks.py,sha256=nWurEENXmey-yWYzseb0lGArz4-Q2S29nGAnNLpytMQ,79642
12
12
  airflow/providers/databricks/operators/databricks_repos.py,sha256=NLigItgvQOpxhDhttkU2Jhrcu1gODXQME2i5f8w7gYk,13311
13
13
  airflow/providers/databricks/operators/databricks_sql.py,sha256=QmFUM83jY0pvnG4K-iM7Kuc4H48ORIx2jgGoOdAtEJw,21836
14
14
  airflow/providers/databricks/operators/databricks_workflow.py,sha256=BAWsfFdEG-7p0_6ykkz-xZX1-vdtHnS8uhwjDFpevyg,15088
15
15
  airflow/providers/databricks/plugins/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
16
- airflow/providers/databricks/plugins/databricks_workflow.py,sha256=EtKDPiCq64b8SlH1pJWjqZSI0Kfr-HmAL4IGWOjuDQY,19817
16
+ airflow/providers/databricks/plugins/databricks_workflow.py,sha256=XTbsGp8C7Y9_Z_At2VghJZts9jPCNagENXD5hJvtwOg,20057
17
17
  airflow/providers/databricks/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
18
18
  airflow/providers/databricks/sensors/databricks.py,sha256=AVSqvHDr7iDXL1WZ46MTN3KUnVSIOc_g5JEViA1MeVE,6428
19
19
  airflow/providers/databricks/sensors/databricks_partition.py,sha256=1PZo-rdRo6E7yBa30ISFjgQ-iaFdqPYm0gnN5tXgxCU,10205
@@ -24,7 +24,7 @@ airflow/providers/databricks/utils/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2
24
24
  airflow/providers/databricks/utils/databricks.py,sha256=ecvzZbC4KdXds47VeSayot9EO-RQnTRJTEwKITH7waQ,5117
25
25
  airflow/providers/databricks/utils/mixins.py,sha256=WUmkt3AmXalmV6zOUIJZWbTldxYunAZOstddDhKCC94,7407
26
26
  airflow/providers/databricks/utils/openlineage.py,sha256=1jT5Woh9YifawdP-VFWsabfF-ecuCjPlzD5P_W4DAhI,15078
27
- apache_airflow_providers_databricks-7.7.1rc1.dist-info/entry_points.txt,sha256=hjmZm3ab2cteTR4t9eE28oKixHwNIKtLCThd6sx3XRQ,227
28
- apache_airflow_providers_databricks-7.7.1rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
- apache_airflow_providers_databricks-7.7.1rc1.dist-info/METADATA,sha256=Y2c7WUOaMhwpE39PuDzys59VQbRlhkAutSK7cNh9Uo4,7297
30
- apache_airflow_providers_databricks-7.7.1rc1.dist-info/RECORD,,
27
+ apache_airflow_providers_databricks-7.7.2rc1.dist-info/entry_points.txt,sha256=hjmZm3ab2cteTR4t9eE28oKixHwNIKtLCThd6sx3XRQ,227
28
+ apache_airflow_providers_databricks-7.7.2rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
+ apache_airflow_providers_databricks-7.7.2rc1.dist-info/METADATA,sha256=hpSINe7B6t6yhfwKBxP7oCFPzQGNdaph_S0DZLvzCtE,7256
30
+ apache_airflow_providers_databricks-7.7.2rc1.dist-info/RECORD,,