From 09cdc8e55225a78d8cdc2cbad343e67d717260a2 Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Mon, 29 Jul 2024 02:57:21 -0500 Subject: [PATCH] Add handling of OperationalError for better mysql support --- database/macrostrat/database/utils.py | 3 ++- database/pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/database/macrostrat/database/utils.py b/database/macrostrat/database/utils.py index 2872398..69bea3d 100644 --- a/database/macrostrat/database/utils.py +++ b/database/macrostrat/database/utils.py @@ -17,6 +17,7 @@ InternalError, InvalidRequestError, ProgrammingError, + OperationalError ) from sqlalchemy.orm import sessionmaker from sqlalchemy.schema import Table @@ -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: diff --git a/database/pyproject.toml b/database/pyproject.toml index 10e9601..0532363 100644 --- a/database/pyproject.toml +++ b/database/pyproject.toml @@ -3,7 +3,7 @@ authors = ["Daven Quinn "] 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"