I'm trying to read an Access query in pandas, but run into the following error. Could anyone kindly assist?
My code seems to work if I convert the ODBC tables to local tables in Access (but I rather not do this). Also, I already tried turning off pooling and it didn't help.
import pyodbc
import pandas as pd
pyodbc.pooling = False
connStr = (
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};"
r"Dbq=C:/users/myname/Documents/database.accdb;"
)
conn = pyodbc.connect(connStr)
df = pd.read_sql("SELECT * FROM query",conn)
Here's the error:
Execution failed on sql 'SELECT * FROM query': ('HY000', "[HY000] [Microsoft][ODBC Microsoft Access Driver] ODBC--connection to 'SQL Server' failed. (-2001) (SQLExecDirectW)")