forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DatabricksTaskOperator (apache#40013)
This pull request introduces the [DatabricksTaskOperator](https://github.com/astronomer/astro-provider-databricks/blob/main/src/astro_databricks/operators/common.py#L26) to the Airflow Databricks provider from the [astro-provider-databricks](https://github.com/astronomer/astro-provider-databricks/tree/main) repository. Unlike the `DatabricksNotebookOperator` which only allows to run Notebook tasks, the `DatabricksTaskOperator` allows running all kinds of tasks across a wide range of types including notebooks, JAR files, Python scripts, Databricks SQL queries and dashboards, Delta Live Tables pipelines, dbt tasks and more that are supported by the [Jobs API in its tasks attribute](https://docs.databricks.com/api/workspace/jobs/create#tasks). It marks another pull request aimed at contributing operators and features from that repository into the Airflow Databricks provider. This PR also abstracts the common implementation between the `DatabricksNotebookOperator` and `DatabricksTaskOperator` into a base abstract class `DatabricksTaskBaseOperator` so that we do not introduce duplicate code for the common set of implementation methods.
- Loading branch information
1 parent
32fd29d
commit 68bd42a
Showing
6 changed files
with
516 additions
and
165 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
docs/apache-airflow-providers-databricks/operators/task.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
.. http://www.apache.org/licenses/LICENSE-2.0 | ||
.. Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
.. _howto/operator:DatabricksTaskOperator: | ||
|
||
|
||
DatabricksTaskOperator | ||
====================== | ||
|
||
Use the :class:`~airflow.providers.databricks.operators.databricks.DatabricksTaskOperator` to launch and monitor | ||
task runs on Databricks as Airflow tasks. This can be used as a standalone operator in a DAG and as well as part of a | ||
Databricks Workflow by using it as an operator(task) within the | ||
:class:`~airflow.providers.databricks.operators.databricks_workflow.DatabricksWorkflowTaskGroup`. | ||
|
||
|
||
|
||
Examples | ||
-------- | ||
|
||
Running a notebook in Databricks using DatabricksTaskOperator | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
.. exampleinclude:: /../../tests/system/providers/databricks/example_databricks.py | ||
:language: python | ||
:start-after: [START howto_operator_databricks_task_notebook] | ||
:end-before: [END howto_operator_databricks_task_notebook] | ||
|
||
Running a SQL query in Databricks using DatabricksTaskOperator | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
.. exampleinclude:: /../../tests/system/providers/databricks/example_databricks.py | ||
:language: python | ||
:start-after: [START howto_operator_databricks_task_sql] | ||
:end-before: [END howto_operator_databricks_task_sql] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters