From e7c936224629832867fc3883f07314c01cbced6d Mon Sep 17 00:00:00 2001 From: Ben Cassell Date: Mon, 29 Jan 2024 16:33:15 -0800 Subject: [PATCH] Does this help? --- CHANGELOG.md | 6 ++++++ dbt/adapters/databricks/__version__.py | 2 +- dbt/adapters/databricks/auth.py | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc3b598..454f01c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## dbt-databricks 1.7.5 (Jan 29, 2024) + +### Fixes + +- Pin databricks sdk to 0.17.0 to fix connection timeout issue ([571](https://github.com/databricks/dbt-databricks/pull/571)) + ## dbt-databricks 1.7.4 (Jan 24, 2024) ### Fixes diff --git a/dbt/adapters/databricks/__version__.py b/dbt/adapters/databricks/__version__.py index f13660c2..a551f5c8 100644 --- a/dbt/adapters/databricks/__version__.py +++ b/dbt/adapters/databricks/__version__.py @@ -1 +1 @@ -version: str = "1.7.4" +version: str = "1.7.5" diff --git a/dbt/adapters/databricks/auth.py b/dbt/adapters/databricks/auth.py index c1975ceb..4d73fcc3 100644 --- a/dbt/adapters/databricks/auth.py +++ b/dbt/adapters/databricks/auth.py @@ -1,6 +1,7 @@ from typing import Any, Dict, Optional from databricks.sdk.oauth import ClientCredentials, Token from databricks.sdk.core import CredentialsProvider, HeaderFactory, Config, credentials_provider +from databricks.sdk.oauth import TokenSource class token_auth(CredentialsProvider): @@ -31,6 +32,8 @@ def inner() -> Dict[str, str]: class m2m_auth(CredentialsProvider): + _token_source: Optional[TokenSource] = None + def __init__(self, host: str, client_id: str, client_secret: str) -> None: @credentials_provider("noop", []) def noop_credentials(_: Any): # type: ignore @@ -65,12 +68,12 @@ def as_dict(self) -> dict: @staticmethod def from_dict(host: str, client_id: str, client_secret: str, raw: dict) -> CredentialsProvider: c = m2m_auth(host=host, client_id=client_id, client_secret=client_secret) - c._token_source._token = Token.from_dict(raw["token"]) + c._token_source._token = Token.from_dict(raw["token"]) # type: ignore return c def __call__(self, _: Optional[Config] = None) -> HeaderFactory: def inner() -> Dict[str, str]: - token = self._token_source.token() + token = self._token_source.token() # type: ignore return {"Authorization": f"{token.token_type} {token.access_token}"} return inner