Skip to content

Commit b5a60d9

Browse files
committed
resolve sqlalchemy reflection drop_table race condition
1 parent 7a31438 commit b5a60d9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/tests/io/test_sql.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,12 @@ def drop_table(
575575
with conn.cursor() as cur:
576576
cur.execute(f'DROP TABLE IF EXISTS "{table_name}"')
577577
else:
578-
with conn.begin() as con:
579-
with sql.SQLDatabase(con) as db:
580-
db.drop_table(table_name)
578+
try:
579+
with conn.begin() as con:
580+
with sql.SQLDatabase(con) as db:
581+
db.drop_table(table_name)
582+
except sqlalchemy.exc.ProgrammingError:
583+
pass
581584

582585

583586
def drop_view(

0 commit comments

Comments
 (0)