from sqlalchemy import create_engine from .conf import DB_CONNECTION_STR conn = create_engine(DB_CONNECTION_STR) def verify_table_exists(table_name): return conn.dialect.has_table(conn, table_name)
Im getting this error :
AttributeError: ‘Engine’ object has no attribute ‘exec_driver_sql’
Advertisement
Answer
Nowadays the preferred method for performing such reflection is to use inspect
:
import sqlalchemy as sa insp = sa.inspect(engine) print(insp.has_table("team"))