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: catalog migration w/o connection #30773

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions superset/migrations/shared/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,17 @@ def upgrade_catalog_perms(engines: set[str] | None = None) -> None:
# analytical DB. If we can't connect to the analytical DB during the migration
# we should stop it, since we need the default catalog in order to update
# existing models.
if default_catalog := database.get_default_catalog():
try:
default_catalog = database.get_default_catalog()
except GenericDBException as ex:
logger.warning(
"Error fetching default catalog for database %s: %s",
database.database_name,
ex,
)
continue

if default_catalog:
upgrade_database_catalogs(database, default_catalog, session)

session.flush()
Expand Down Expand Up @@ -558,7 +568,17 @@ def downgrade_catalog_perms(engines: set[str] | None = None) -> None:
) or not db_engine_spec.supports_catalog:
continue

if default_catalog := database.get_default_catalog():
try:
default_catalog = database.get_default_catalog()
except GenericDBException as ex:
logger.warning(
"Error fetching default catalog for database %s: %s",
database.database_name,
ex,
)
continue

if default_catalog:
downgrade_database_catalogs(database, default_catalog, session)

session.flush()
Expand Down
Loading