chore(dao/command): Add transaction decorator to try to enforce "unit of work" (#24969)

This commit is contained in:
John Bodley
2024-06-28 12:33:56 -07:00
committed by GitHub
parent a3f0d00714
commit 8fb8199a55
151 changed files with 681 additions and 916 deletions

View File

@@ -90,6 +90,7 @@ class SynchronousSqlJsonExecutor(SqlJsonExecutorBase):
rendered_query: str,
log_params: dict[str, Any] | None,
) -> SqlJsonExecutionStatus:
print(">>> execute <<<")
query_id = execution_context.query.id
try:
data = self._get_sql_results_with_timeout(
@@ -101,6 +102,7 @@ class SynchronousSqlJsonExecutor(SqlJsonExecutorBase):
raise
except Exception as ex:
logger.exception("Query %i failed unexpectedly", query_id)
print(str(ex))
raise SupersetGenericDBErrorException(
utils.error_msg_from_exception(ex)
) from ex
@@ -112,6 +114,7 @@ class SynchronousSqlJsonExecutor(SqlJsonExecutorBase):
[SupersetError(**params) for params in data["errors"]] # type: ignore
)
# old string-only error message
print(data)
raise SupersetGenericDBErrorException(data["error"]) # type: ignore
return SqlJsonExecutionStatus.HAS_RESULTS