Skip to content

Commit

Permalink
Slightly update Macrostrat database utils to better work with non-Pos…
Browse files Browse the repository at this point in the history
…tgreSQL query running
  • Loading branch information
davenquinn committed Sep 12, 2024
1 parent abc997c commit 58753a1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 29 deletions.
5 changes: 3 additions & 2 deletions database/macrostrat/database/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,10 @@ def _should_raise_query_error(err):
return True

# If we cancel statements midstream, we should raise the error.
# We might want to change this behavior in the future.
# We might want to change this behavior in the future, or support more graceful handling of errors from other
# database backends.
# Ideally we could handle operational errors more gracefully
if isinstance(orig_err, psycopg2.errors.QueryCanceled) or orig_err.pgcode == "57014":
if isinstance(orig_err, psycopg2.errors.QueryCanceled) or getattr(orig_err, "pgcode", None) == "57014":
return True

return False
Expand Down
2 changes: 1 addition & 1 deletion database/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Daven Quinn <[email protected]>"]
description = "A SQLAlchemy-based database toolkit."
name = "macrostrat.database"
packages = [{ include = "macrostrat" }]
version = "3.3.2"
version = "3.3.3"

[tool.poetry.dependencies]
GeoAlchemy2 = "^0.14.0"
Expand Down
4 changes: 2 additions & 2 deletions dinosaur/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-tools/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 31 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 58753a1

Please sign in to comment.