
.. 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.


Package ``apache-airflow-providers-databricks``

Release: ``4.2.0rc1``


`Databricks <https://databricks.com/>`__


Provider package
----------------

This is a provider package for ``databricks`` provider. All classes for this provider package
are in ``airflow.providers.databricks`` python package.

You can find package information and changelog for the provider
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-databricks/4.2.0/>`_.


Installation
------------

You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
for the minimum Airflow version supported) via
``pip install apache-airflow-providers-databricks``

The package supports the following python versions: 3.7,3.8,3.9,3.10

Requirements
------------

=======================================  ===================
PIP package                              Version required
=======================================  ===================
``apache-airflow``                       ``>=2.4.0``
``apache-airflow-providers-common-sql``  ``>=1.5.0``
``requests``                             ``>=2.27,<3``
``databricks-sql-connector``             ``>=2.0.0, <3.0.0``
``aiohttp``                              ``>=3.6.3, <4``
=======================================  ===================

Cross provider package dependencies
-----------------------------------

Those are dependencies that might be needed in order to use all the features of the package.
You need to install the specified provider packages in order to use them.

You can install such cross-provider dependencies when installing from PyPI. For example:

.. code-block:: bash

    pip install apache-airflow-providers-databricks[common.sql]


============================================================================================================  ==============
Dependent package                                                                                             Extra
============================================================================================================  ==============
`apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_  ``common.sql``
============================================================================================================  ==============

 .. 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.


.. NOTE TO CONTRIBUTORS:
   Please, only add notes to the Changelog just below the "Changelog" header when there are some breaking changes
   and you want to add an explanation to the users on how they are supposed to deal with them.
   The changelog is updated and maintained semi-automatically by release manager.

Changelog
---------

4.2.0
.....

.. note::
  This release of provider is only available for Airflow 2.4+ as explained in the
  `Apache Airflow providers support policy <https://github.com/apache/airflow/blob/main/PROVIDERS.rst#minimum-supported-version-of-airflow-for-community-managed-providers>`_.

Features
~~~~~~~~

* ``Add conditional output processing in SQL operators (#31136)``
* ``Add cancel all runs functionality to Databricks hook (#31038)``
* ``Add retry param in databrics async operator (#30744)``
* ``Add repair job functionality to databricks hook (#30786)``
* ``Add 'DatabricksPartitionSensor' (#30980)``

Misc
~~~~

* ``Bump minimum Airflow version in providers (#30917)``
* ``Deprecate databricks async operator (#30761)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Move TaskInstanceKey to a separate file (#31033)``
   * ``Use 'AirflowProviderDeprecationWarning' in providers (#30975)``
   * ``Add full automation for min Airflow version for providers (#30994)``
   * ``Add cli cmd to list the provider trigger info (#30822)``

4.1.0
.....

Features
~~~~~~~~

* ``Add delete inactive run functionality to databricks provider (#30646)``
* ``Databricks SQL sensor (#30477)``


.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Add mechanism to suspend providers (#30422)``

4.0.1
.....

Bug Fixes
~~~~~~~~~

* ``DatabricksSubmitRunOperator to support taskflow (#29840)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``adding trigger info to provider yaml (#29950)``

4.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

The ``DatabricksSqlHook`` is now conforming to the same semantics as all the other ``DBApiHook``
implementations and returns the same kind of response in its ``run`` method. Previously (pre 4.* versions
of the provider, the Hook returned Tuple of ("cursor description", "results") which was not compatible
with other DBApiHooks that return just "results". After this change (and dependency on common.sql >= 1.3.1),
The ``DatabricksSqlHook`` returns now "results" only. The ``description`` can be retrieved via
``last_description`` field of the hook after ``run`` method completes.

That makes the ``DatabricksSqlHook`` suitable for generic SQL operator and detailed lineage analysis.

If you had custom hooks or used the Hook in your TaskFlow code or custom operators that relied on this
behaviour, you need to adapt your DAGs.

The Databricks ``DatabricksSQLOperator`` is also more standard and derives from common
``SQLExecuteQueryOperator`` and uses more consistent approach to process output when SQL queries are run.
However in this case the result returned by ``execute`` method is unchanged (it still returns Tuple of
("description", "results") and this Tuple is pushed to XCom, so your DAGs relying on this behaviour
should continue working without any change.

* ``Fix errors in Databricks SQL operator introduced when refactoring (#27854)``
* ``Bump common.sql provider to 1.3.1 (#27888)``

Bug Fixes
~~~~~~~~~

* ``Fix templating fields and do_xcom_push in DatabricksSQLOperator (#27868)``
* ``Fixing the behaviours of SQL Hooks and Operators finally (#27912)``


.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Prepare for follow-up release for November providers (#27774)``

3.4.0
.....

.. note::
  This release of provider is only available for Airflow 2.3+ as explained in the
  `Apache Airflow providers support policy <https://github.com/apache/airflow/blob/main/PROVIDERS.rst#minimum-supported-version-of-airflow-for-community-managed-providers>`_.

Misc
~~~~

* ``Move min airflow version to 2.3.0 for all providers (#27196)``
* ``Replace urlparse with urlsplit (#27389)``

Features
~~~~~~~~

* ``Add SQLExecuteQueryOperator (#25717)``
* ``Use new job search API for triggering Databricks job by name (#27446)``


.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Update old style typing (#26872)``
   * ``Enable string normalization in python formatting - providers (#27205)``

3.3.0
.....

Features
~~~~~~~~

* ``DatabricksSubmitRunOperator dbt task support (#25623)``

Misc
~~~~

* ``Add common-sql lower bound for common-sql (#25789)``
* ``Remove duplicated connection-type within the provider (#26628)``

Bug Fixes
~~~~~~~~~

* ``Databricks: fix provider name in the User-Agent string (#25873)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Apply PEP-563 (Postponed Evaluation of Annotations) to non-core airflow (#26289)``
   * ``D400 first line should end with period batch02 (#25268)``

3.2.0
.....

Features
~~~~~~~~

* ``Databricks: update user-agent string (#25578)``
* ``More improvements in the Databricks operators (#25260)``
* ``Improved telemetry for Databricks provider (#25115)``
* ``Unify DbApiHook.run() method with the methods which override it (#23971)``

Bug Fixes
~~~~~~~~~

* ``Databricks: fix test_connection implementation (#25114)``
* ``Do not convert boolean values to string in deep_string_coerce function (#25394)``
* ``Correctly handle output of the failed tasks (#25427)``
* ``Databricks: Fix provider for Airflow 2.2.x (#25674)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``updated documentation for databricks operator (#24599)``
   * ``Prepare docs for new providers release (August 2022) (#25618)``

3.1.0
.....

Features
~~~~~~~~

* ``Added databricks_conn_id as templated field (#24945)``
* ``Add 'test_connection' method to Databricks hook (#24617)``
* ``Move all SQL classes to common-sql provider (#24836)``

Bug Fixes
~~~~~~~~~

* ``Update providers to use functools compat for ''cached_property'' (#24582)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Automatically detect if non-lazy logging interpolation is used (#24910)``
   * ``Remove "bad characters" from our codebase (#24841)``
   * ``Move provider dependencies to inside provider folders (#24672)``
   * ``Remove 'hook-class-names' from provider.yaml (#24702)``

3.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

.. note::
  This release of provider is only available for Airflow 2.2+ as explained in the
  `Apache Airflow providers support policy <https://github.com/apache/airflow/blob/main/PROVIDERS.rst#minimum-supported-version-of-airflow-for-community-managed-providers>`_.

Features
~~~~~~~~

* ``Add Deferrable Databricks operators (#19736)``
* ``Add git_source to DatabricksSubmitRunOperator (#23620)``

Bug Fixes
~~~~~~~~~

* ``fix: DatabricksSubmitRunOperator and DatabricksRunNowOperator cannot define .json as template_ext (#23622) (#23641)``
* ``Fix UnboundLocalError when sql is empty list in DatabricksSqlHook (#23815)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``AIP-47 - Migrate databricks DAGs to new design #22442 (#24203)``
   * ``Introduce 'flake8-implicit-str-concat' plugin to static checks (#23873)``
   * ``Add explanatory note for contributors about updating Changelog (#24229)``
   * ``Prepare docs for May 2022 provider's release (#24231)``
   * ``Update package description to remove double min-airflow specification (#24292)``

2.7.0
.....

Features
~~~~~~~~

* ``Update to the released version of DBSQL connector``
* ``DatabricksSqlOperator - switch to databricks-sql-connector 2.x``
* ``Further improvement of Databricks Jobs operators (#23199)``


.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Address review comments``
   * ``Clean up in-line f-string concatenation (#23591)``
   * ``Use new Breese for building, pulling and verifying the images. (#23104)``

2.6.0
.....

Features
~~~~~~~~

* ``More operators for Databricks Repos (#22422)``
* ``Add a link to Databricks Job Run (#22541)``
* ``Databricks SQL operators are now Python 3.10 compatible (#22886)``

Bug Fixes
~~~~~~~~~

* ``Databricks: Correctly handle HTTP exception (#22885)``

Misc
~~~~

* ``Refactor 'DatabricksJobRunLink' to not create ad hoc TaskInstances (#22571)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Update black precommit (#22521)``
   * ``Fix new MyPy errors in main (#22884)``
   * ``Prepare mid-April provider documentation. (#22819)``

   * ``Prepare for RC2 release of March Databricks provider (#22979)``

2.5.0
.....

Features
~~~~~~~~

* ``Operator for updating Databricks Repos (#22278)``

Bug Fixes
~~~~~~~~~

* ``Fix mistakenly added install_requires for all providers (#22382)``

2.4.0
.....

Features
~~~~~~~~

* ``Add new options to DatabricksCopyIntoOperator (#22076)``
* ``Databricks hook - retry on HTTP Status 429 as well (#21852)``

Misc
~~~~

* ``Skip some tests for Databricks from running on Python 3.10 (#22221)``

2.3.0
.....

Features
~~~~~~~~

* ``Add-showing-runtime-error-feature-to-DatabricksSubmitRunOperator (#21709)``
* ``Databricks: add support for triggering jobs by name (#21663)``
* ``Added template_ext = ('.json') to databricks operators #18925 (#21530)``
* ``Databricks SQL operators (#21363)``

Bug Fixes
~~~~~~~~~

* ``Fixed changelog for January 2022 (delayed) provider's release (#21439)``

Misc
~~~~

* ``Support for Python 3.10``
* ``Updated Databricks docs for correct jobs 2.1 API and links (#21494)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Add documentation for January 2021 providers release (#21257)``
   * ``Remove ':type' lines now sphinx-autoapi supports typehints (#20951)``

2.2.0
.....

Features
~~~~~~~~

* ``Add 'wait_for_termination' argument for Databricks Operators (#20536)``
* ``Update connection object to ''cached_property'' in ''DatabricksHook'' (#20526)``
* ``Remove 'host' as an instance attr in 'DatabricksHook' (#20540)``
* ``Databricks: fix verification of Managed Identity (#20550)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Fix MyPy Errors for Databricks provider. (#20265)``
   * ``Use typed Context EVERYWHERE (#20565)``
   * ``Fix template_fields type to have MyPy friendly Sequence type (#20571)``
   * ``Fix mypy databricks operator (#20598)``
   * ``Update documentation for provider December 2021 release (#20523)``

2.1.0
.....

Features
~~~~~~~~

* ``Databricks: add more methods to represent run state information (#19723)``
* ``Databricks - allow Azure SP authentication on other Azure clouds (#19722)``
* ``Databricks: allow to specify PAT in Password field (#19585)``
* ``Databricks jobs 2.1 (#19544)``
* ``Update Databricks API from 2.0 to 2.1 (#19412)``
* ``Authentication with AAD tokens in Databricks provider (#19335)``
* ``Update Databricks operators to match latest version of API 2.0 (#19443)``
* ``Remove db call from DatabricksHook.__init__() (#20180)``

Bug Fixes
~~~~~~~~~

* ``Fixup string concatenations (#19099)``
* ``Databricks hook: fix expiration time check (#20036)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Prepare documentation for October Provider's release (#19321)``
   * ``Refactor DatabricksHook (#19835)``
   * ``Update documentation for November 2021 provider's release (#19882)``
   * ``Unhide changelog entry for databricks (#20128)``
   * ``Update documentation for RC2 release of November Databricks Provider (#20086)``

2.0.2
.....

Bug Fixes
~~~~~~~~~
   * ``Move DB call out of DatabricksHook.__init__ (#18339)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Static start_date and default arg cleanup for misc. provider example DAGs (#18597)``

2.0.1
.....

Misc
~~~~

* ``Optimise connection importing for Airflow 2.2.0``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Update description about the new ''connection-types'' provider meta-data (#17767)``
   * ``Import Hooks lazily individually in providers manager (#17682)``
   * ``Prepares docs for Rc2 release of July providers (#17116)``
   * ``Prepare documentation for July release of providers. (#17015)``
   * ``Removes pylint from our toolchain (#16682)``

2.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

* ``Auto-apply apply_default decorator (#15667)``

.. warning:: Due to apply_default decorator removal, this version of the provider requires Airflow 2.1.0+.
   If your Airflow version is < 2.1.0, and you want to install this provider version, first upgrade
   Airflow to at least version 2.1.0. Otherwise your Airflow package version will be upgraded
   automatically and you will have to manually run ``airflow upgrade db`` to complete the migration.

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Prepares provider release after PIP 21 compatibility (#15576)``
   * ``An initial rework of the 'Concepts' docs (#15444)``
   * ``Remove Backport Providers (#14886)``
   * ``Updated documentation for June 2021 provider release (#16294)``
   * ``Add documentation for Databricks connection (#15410)``
   * ``More documentation update for June providers release (#16405)``
   * ``Synchronizes updated changelog after buggfix release (#16464)``

1.0.1
.....

Updated documentation and readme files.

1.0.0
.....

Initial version of the provider.
