diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cefd9c..a88c5413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 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 56bf196c..ccf32c98 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")