Skip to content

Commit

Permalink
Catch operational error
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Apr 15, 2024
1 parent 1ae93c4 commit 7dc30a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gramps_webapi/undodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
Text,
create_engine,
)
from sqlalchemy.exc import OperationalError
from sqlalchemy.orm import declarative_base, relationship, sessionmaker
from sqlalchemy.sql import func

Expand Down Expand Up @@ -205,7 +206,11 @@ def open(self, value=None) -> None:
"""
Open the backing storage.
"""
Base.metadata.create_all(self.engine)
try:
Base.metadata.create_all(self.engine)
except OperationalError as e:
if "already exists" not in str(e):
raise

def _make_connection_id(self) -> int:
"""Insert a row into the connection table."""
Expand Down

0 comments on commit 7dc30a1

Please sign in to comment.