michael-s-molina commented on code in PR #30017: URL: https://github.com/apache/superset/pull/30017#discussion_r1731717238
########## superset/migrations/versions/2024-08-13_15-27_e53fd48cc078_remove_sl_dataset_users.py: ########## @@ -34,9 +34,14 @@ def upgrade(): connection = op.get_bind() - if connection.dialect.name != "sqlite": - drop_fks_for_table("sl_dataset_users") - op.drop_table("sl_dataset_users") + + try: + if connection.dialect.name != "sqlite": + drop_fks_for_table("sl_dataset_users") + op.drop_table("sl_dataset_users") + except sa.exc.NoSuchTableError: Review Comment: @sadpandajoe Would you mind adding a method called `has_table` to https://github.com/apache/superset/blob/master/superset/migrations/shared/utils.py to be reused in these and future migrations? ``` def has_table(table_name: str) -> bool: """ Check if a table exists in the database. :param table_name: The table name :returns: True iff the table exists """ insp = inspect(op.get_context().bind) return insp.has_table(table_name) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org