Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix schema creation errors while adding a new connection #3490

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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