Skip to content

Commit

Permalink
resolve sqlalchemy reflection drop_table race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
UmbertoFasci committed Dec 21, 2024
1 parent 7a31438 commit b5a60d9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,12 @@ def drop_table(
with conn.cursor() as cur:
cur.execute(f'DROP TABLE IF EXISTS "{table_name}"')
else:
with conn.begin() as con:
with sql.SQLDatabase(con) as db:
db.drop_table(table_name)
try:
with conn.begin() as con:
with sql.SQLDatabase(con) as db:
db.drop_table(table_name)
except sqlalchemy.exc.ProgrammingError:
pass


def drop_view(
Expand Down

0 comments on commit b5a60d9

Please sign in to comment.