Skip to content

Commit

Permalink
Merge pull request #3490 from mathesar-foundation/fix_schema_creation…
Browse files Browse the repository at this point in the history
…_failure

Fix schema creation errors while adding a new connection
  • Loading branch information
mathemancer committed Mar 15, 2024
2 parents f950fed + 311a3a2 commit a6d5cd9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mathesar/utils/connections.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Utilities to help with creating and managing connections in Mathesar."""
from psycopg2.errors import DuplicateSchema
from sqlalchemy.exc import OperationalError
from sqlalchemy.exc import OperationalError, ProgrammingError
from mathesar.models.base import Database
from db import install, connection as dbconn
from mathesar.state import reset_reflection
Expand Down Expand Up @@ -92,10 +92,11 @@ def _load_sample_data(engine, sample_data):
for key in sample_data:
try:
DATASET_MAP[key](engine, safe_mode=True)
except DuplicateSchema:
# We swallow this error, since otherwise we'll raise an error on the
# front end even though installation generally succeeded.
continue
except ProgrammingError as e:
if isinstance(e.orig, DuplicateSchema):
# We swallow this error, since otherwise we'll raise an error on the
# front end even though installation generally succeeded.
continue
reset_reflection()


Expand Down

0 comments on commit a6d5cd9

Please sign in to comment.