From 6bcd4eadcc5bef37719b869048e1f1dfa312f6ae Mon Sep 17 00:00:00 2001 From: Ben Cassell <98852248+benc-db@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:39:49 -0700 Subject: [PATCH] Fixing failing tests from newer dbt versions (#817) --- dbt/adapters/databricks/connections.py | 7 ++++--- dev-requirements.txt | 2 +- tests/functional/adapter/constraints/fixtures.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dbt/adapters/databricks/connections.py b/dbt/adapters/databricks/connections.py index cf6f600a7..c4a297b41 100644 --- a/dbt/adapters/databricks/connections.py +++ b/dbt/adapters/databricks/connections.py @@ -75,6 +75,7 @@ from dbt_common.events.functions import fire_event from dbt_common.exceptions import DbtInternalError from dbt_common.exceptions import DbtRuntimeError +from dbt_common.exceptions import DbtDatabaseError from dbt_common.utils import cast_to_str from requests import Session @@ -508,7 +509,7 @@ def exception_handler(self, sql: str) -> Iterator[None]: except Error as exc: logger.debug(QueryError(log_sql, exc)) - raise DbtRuntimeError(str(exc)) from exc + raise DbtDatabaseError(str(exc)) from exc except Exception as exc: logger.debug(QueryError(log_sql, exc)) @@ -518,9 +519,9 @@ def exception_handler(self, sql: str) -> Iterator[None]: thrift_resp = exc.args[0] if hasattr(thrift_resp, "status"): msg = thrift_resp.status.errorMessage - raise DbtRuntimeError(msg) from exc + raise DbtDatabaseError(msg) from exc else: - raise DbtRuntimeError(str(exc)) from exc + raise DbtDatabaseError(str(exc)) from exc # override/overload def set_connection_name( diff --git a/dev-requirements.txt b/dev-requirements.txt index 46c95b6e1..0c3ba4589 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -15,4 +15,4 @@ types-requests types-mock pre-commit -dbt-tests-adapter~=1.8.0 +dbt-tests-adapter>=1.10.0, <2.0 diff --git a/tests/functional/adapter/constraints/fixtures.py b/tests/functional/adapter/constraints/fixtures.py index 1a9d10132..7a1c3ee34 100644 --- a/tests/functional/adapter/constraints/fixtures.py +++ b/tests/functional/adapter/constraints/fixtures.py @@ -81,7 +81,7 @@ - type: foreign_key name: fk_example__child_table_1 columns: ["parent_id"] - to: parent_table + to: ref('parent_table') to_columns: ["id"] columns: - name: id