Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unraised DbtDatabaseError #434

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading