I'm trying to read the Table names from a database into a list using Pandas.read_sql. I have tried different SQL queries found online:
cnxn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=' + str(self.file_selected)+';Uid=Admin;Pwd=; ')
# sql = "SELECT * FROM SYS.TABLES" # tried this - also an error
sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA='database_name.MDB'"
self.TableNames = pd.io.sql.read_sql(sql, cnxn)
cnxn.close()
but I get an error that it can not find the file database_name.INFORMATION_SCHEMA.TABLES
what should I use for the sql query?
INFORMATION_SCHEMAinMS Access...