I am trying to write a Pandas Dataframe called df
into a Table in SQL Express as in the code below, but I get the error DBAPIError: (pyodbc.Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
in the line engine = sqlalchemy.create_engine('mssql://LENOVO-PC\SQlEXPRESS\\SQLEXPRESS/Databasewithinfo?trusted_connection=yes')
. I saw the answer in this post and tried to follow that. I know that my server_name = LENOVO-PC\SQlEXPRESS
and that database_name = Databasewithinfo
and am thus struggling to understand where I'm going wrong.
import sqlalchemy
from sqlalchemy import create_engine
engine = sqlalchemy.create_engine('mssql://LENOVO-PC\SQlEXPRESS\\SQLEXPRESS/Databasewithinfo?trusted_connection=yes')
df.to_sql('JPY_data', engine, chunksize=1000)
Thank You