From af592ecea6bfef0e019afd9327ebc2ef1bd8e899 Mon Sep 17 00:00:00 2001 From: jnadal Date: Fri, 30 Aug 2024 11:20:10 +0200 Subject: [PATCH] fix dbtDatabaseError --- CHANGELOG.md | 1 + dbt/adapters/glue/gluedbapi/cursor.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1255ed3..58482c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Add on_schema_change possibility - Fix table materialization for Delta models - Change GlueColumn parent from base Column to SparkColumn +- Fix unraised DbtDatabaseError ## v1.8.1 - Fix typo in README.md diff --git a/dbt/adapters/glue/gluedbapi/cursor.py b/dbt/adapters/glue/gluedbapi/cursor.py index faac8e4..2837246 100644 --- a/dbt/adapters/glue/gluedbapi/cursor.py +++ b/dbt/adapters/glue/gluedbapi/cursor.py @@ -3,6 +3,7 @@ import json from dbt.adapters.contracts.connection import AdapterResponse from dbt import exceptions as dbterrors +from dbt_common.exceptions import DbtDatabaseError from dbt.adapters.glue.gluedbapi.commons import GlueStatement from dbt.adapters.glue.util import get_pandas_dataframe_from_result_file from dbt.adapters.events.logging import AdapterLogger @@ -128,7 +129,7 @@ def execute(self, sql, bindings=None): logger.error(error_message) else: logger.debug(error_message) - raise dbterrors.DbtDatabaseError(msg=error_message) + raise DbtDatabaseError(msg=error_message) self.result = self.response if self.connection.use_arrow: @@ -143,11 +144,11 @@ def execute(self, sql, bindings=None): output = response.get("Statement", {}).get("Output", {}) error_message = f"Glue cursor returned `{output.get('Status')}` for statement {self.statement_id} for code {self.code}, {output.get('ErrorName')}: {output.get('ErrorValue')}" logger.debug(error_message) - raise dbterrors.DbtDatabaseError(msg=error_message) + raise DbtDatabaseError(msg=error_message) if self.state in [GlueCursorState.CANCELLED, GlueCursorState.CANCELLING]: self._post() - raise dbterrors.DbtDatabaseError( + raise DbtDatabaseError( msg=f"Statement {self.connection.session_id}.{self.statement_id} cancelled.") logger.debug("GlueCursor execute successfully")