I keep encountering this error upon executing df.to_sql.I want to append existing data from a csv file into a MS DB file (accdb). Can you please help me out? I cant see anywhere in the internet a solution about this error.The DB has been created already, with column names but no data yet.
TypeError: has_table() got an unexpected keyword argument 'info_cache'
Here's my code:
import sqlalchemy as sa
import pandas as pd
connection_string = (
r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};"
r"DBQ=C:/Users/usrname/Desktop/Folder/test.accdb;"
r"ExtendedAnsiSQL=1;"
)
connection_url = sa.engine.URL.create(
"access+pyodbc",
query={"odbc_connect": connection_string}
)
engine = sa.create_engine(connection_url)
df = pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3']})
df.to_sql('users', con=engine)