I use the following code to insert a DataFrame into an SSMS Database where data is a pd.DataFrame.
from sqlalchemy import create_engine
engine = create_engine(f'mssql+pyodbc:///?odbc_connect={connection_string}', fast_executemany=True)
with engine.connect() as connection:
data.to_sql(
'tablename',
connection,
if_exists='append',
index=False,
})
The code passes and I dont receive any error. However, the database does not change even though it should.
How can I debug this code?
1