Skip to content

Commit

Permalink
fix dbtDatabaseError
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremynadal33 committed Aug 30, 2024
1 parent ad1ee05 commit af592ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions dbt/adapters/glue/gluedbapi/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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")
Expand Down

0 comments on commit af592ec

Please sign in to comment.