Skip to content

Commit

Permalink
Add handling of OperationalError for better mysql support
Browse files Browse the repository at this point in the history
  • Loading branch information
davenquinn committed Jul 29, 2024
1 parent 20c14b5 commit 09cdc8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion database/macrostrat/database/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
InternalError,
InvalidRequestError,
ProgrammingError,
OperationalError
)
from sqlalchemy.orm import sessionmaker
from sqlalchemy.schema import Table
Expand Down Expand Up @@ -309,7 +310,7 @@ def _run_sql(connectable, sql, params=None, **kwargs):
elif hasattr(connectable, "commit"):
connectable.commit()
pretty_print(sql_text, dim=True)
except (ProgrammingError, IntegrityError, InternalError) as err:
except (ProgrammingError, IntegrityError, InternalError, OperationalError) as err:
_err = str(err.orig).strip()
dim = "already exists" in _err
if trans is not None:
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.0"
version = "3.3.1"

[tool.poetry.dependencies]
GeoAlchemy2 = "^0.14.0"
Expand Down

0 comments on commit 09cdc8e

Please sign in to comment.