From be280909c80cfc60c79d7eb0b3eef95af9abf8ba Mon Sep 17 00:00:00 2001 From: Umberto Fasci Date: Fri, 20 Dec 2024 18:45:50 -0600 Subject: [PATCH] resolve drop_table sqlalchemy reflection error handling --- pandas/tests/io/test_sql.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 213b229e7432d..23c330d0f6587 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -565,6 +565,8 @@ def drop_table( table_name: str, conn: sqlite3.Connection | sqlalchemy.engine.Engine | sqlalchemy.engine.Connection, ): + import sqlalchemy + if isinstance(conn, sqlite3.Connection): conn.execute(f"DROP TABLE IF EXISTS {sql._get_valid_sqlite_name(table_name)}") conn.commit()