Skip to content

Commit

Permalink
Does this help?
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Jan 30, 2024
1 parent 525b689 commit e7c9362
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/databricks/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: str = "1.7.4"
version: str = "1.7.5"
7 changes: 5 additions & 2 deletions dbt/adapters/databricks/auth.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit e7c9362

Please sign in to comment.