diff --git a/CHANGELOG.md b/CHANGELOG.md index b06b7437..607e0dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - Fix places where we were not properly closing cursors, and other test warnings ([713](https://github.com/databricks/dbt-databricks/pull/713)) - Upgrade databricks-sql-connector dependency to 3.2.0 ([729](https://github.com/databricks/dbt-databricks/pull/729)) -## dbt-databricks 1.8.5 (TBD) +## dbt-databricks 1.8.5 (August 6, 2024) ### Fixes @@ -18,6 +18,7 @@ - Always use lower case when gathering metadata (since objects are stored internally as lower case regardless of how we create them) ([742](https://github.com/databricks/dbt-databricks/pull/742)) - Persist table comments for python models ([743](https://github.com/databricks/dbt-databricks/pull/743)) - Stop cursor destructor warnings ([744](https://github.com/databricks/dbt-databricks/pull/744)) +- Race condition on cluster creation. (thanks @jurasan!) ([751](https://github.com/databricks/dbt-databricks/pull/751)) ## dbt-databricks 1.8.4 (July 17, 2024) diff --git a/dbt/adapters/databricks/__version__.py b/dbt/adapters/databricks/__version__.py index dc09b9b7..4db8df56 100644 --- a/dbt/adapters/databricks/__version__.py +++ b/dbt/adapters/databricks/__version__.py @@ -1 +1 @@ -version: str = "1.8.4" +version: str = "1.8.5" diff --git a/dbt/adapters/databricks/impl.py b/dbt/adapters/databricks/impl.py index b7ec28ac..6d45b755 100644 --- a/dbt/adapters/databricks/impl.py +++ b/dbt/adapters/databricks/impl.py @@ -173,14 +173,18 @@ def acquire_connection( # override @contextmanager - def connection_named(self, name: str, query_header_context: Any = None) -> Iterator[None]: + def connection_named( + self, name: str, query_header_context: Any = None, should_release_connection: bool = True + ) -> Iterator[None]: try: if self.connections.query_header is not None: self.connections.query_header.set(name, query_header_context) self.acquire_connection(name, query_header_context) yield finally: - self.release_connection() + if should_release_connection: + self.release_connection() + if self.connections.query_header is not None: self.connections.query_header.reset() diff --git a/requirements.txt b/requirements.txt index b32a7c7e..d876ca91 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ databricks-sql-connector>=3.2.0, <3.3.0 dbt-spark~=1.8.0 -dbt-core~=1.8.0 -dbt-adapters~=1.2.0 +dbt-core>=1.8.0, <2.0 +dbt-adapters>=1.3.0, <2.0 databricks-sdk==0.17.0 keyring>=23.13.0 -protobuf<5.0.0 \ No newline at end of file +protobuf<5.0.0 diff --git a/setup.py b/setup.py index 4585bd78..543e03bb 100644 --- a/setup.py +++ b/setup.py @@ -55,8 +55,8 @@ def _get_plugin_version() -> str: include_package_data=True, install_requires=[ "dbt-spark>=1.8.0, <2.0", - "dbt-core~=1.8.0", - "dbt-adapters~=1.2.0", + "dbt-core>=1.8.0, <2.0", + "dbt-adapters>=1.3.0, <2.0", "databricks-sql-connector>=3.2.0, <3.3.0", "databricks-sdk==0.17.0", "keyring>=23.13.0", diff --git a/tests/profiles.py b/tests/profiles.py index 41768861..2c80af44 100644 --- a/tests/profiles.py +++ b/tests/profiles.py @@ -31,7 +31,7 @@ def _build_databricks_cluster_target( "connect_retries": 3, "connect_timeout": 5, "retry_all": True, - "auth_type": "oauth", + "auth_type": os.getenv("DBT_DATABRICKS_AUTH_TYPE", "oauth"), } if catalog is not None: profile["catalog"] = catalog @@ -39,6 +39,8 @@ def _build_databricks_cluster_target( profile["schema"] = schema if session_properties is not None: profile["session_properties"] = session_properties + if os.getenv("DBT_DATABRICKS_PORT"): + profile["connection_parameters"] = {"_port": os.getenv("DBT_DATABRICKS_PORT")} return profile