diff --git a/CHANGELOG.md b/CHANGELOG.md index 49f08cfb..450387a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ ## dbt-databricks 1.9.6 (TBD) +### Fixes + +- Fix for parse raising error for not having credentials ([941](https://github.com/databricks/dbt-databricks/pull/941)) + ### Under the Hood - Refactoring of some connection internals ([929](https://github.com/databricks/dbt-databricks/pull/929)) diff --git a/dbt/adapters/databricks/connections.py b/dbt/adapters/databricks/connections.py index 7dee852e..68c712cf 100644 --- a/dbt/adapters/databricks/connections.py +++ b/dbt/adapters/databricks/connections.py @@ -202,12 +202,19 @@ class DatabricksConnectionManager(SparkConnectionManager): def __init__(self, profile: AdapterRequiredConfig, mp_context: SpawnContext): super().__init__(profile, mp_context) - creds = cast(DatabricksCredentials, self.profile.credentials) - self.api_client = DatabricksApiClient.create(creds, 15 * 60) + self._api_client: Optional[DatabricksApiClient] = None self.threads_compute_connections: dict[ Hashable, dict[Hashable, DatabricksDBTConnection] ] = {} + @property + def api_client(self) -> DatabricksApiClient: + if self._api_client is None: + self._api_client = DatabricksApiClient.create( + cast(DatabricksCredentials, self.profile.credentials), 15 * 60 + ) + return self._api_client + def cancel_open(self) -> list[str]: cancelled = super().cancel_open() logger.info("Cancelling open python jobs")