Use db.connection.ensure_connection()

This commit is contained in:
tcely 2025-05-15 04:09:14 -04:00 committed by GitHub
parent 1142fb6844
commit be1617979f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,6 +24,7 @@ def SQLTable(arg_table):
needle = arg_table needle = arg_table
if needle.startswith('new__'): if needle.startswith('new__'):
needle = arg_table[len('new__'):] needle = arg_table[len('new__'):]
db.connection.ensure_connection()
valid_table_name = ( valid_table_name = (
needle in new_tables and needle in new_tables and
arg_table in db_tables(include_views=False) arg_table in db_tables(include_views=False)
@ -122,6 +123,7 @@ class Command(BaseCommand):
+ f': {db.connection.vendor}' + f': {db.connection.vendor}'
) )
db.connection.ensure_connection()
db_is_mariadb = ( db_is_mariadb = (
hasattr(db.connection, 'mysql_is_mariadb') and hasattr(db.connection, 'mysql_is_mariadb') and
db.connection.is_usable() and db.connection.is_usable() and