Skip to content

Commit 7dc30a1

Browse files
committed
Catch operational error
1 parent 1ae93c4 commit 7dc30a1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gramps_webapi/undodb.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
Text,
4444
create_engine,
4545
)
46+
from sqlalchemy.exc import OperationalError
4647
from sqlalchemy.orm import declarative_base, relationship, sessionmaker
4748
from sqlalchemy.sql import func
4849

@@ -205,7 +206,11 @@ def open(self, value=None) -> None:
205206
"""
206207
Open the backing storage.
207208
"""
208-
Base.metadata.create_all(self.engine)
209+
try:
210+
Base.metadata.create_all(self.engine)
211+
except OperationalError as e:
212+
if "already exists" not in str(e):
213+
raise
209214

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

0 commit comments

Comments
 (0)