I need to use pandas df.to_sql without auto commit at the end. Is there a way to do that?
Thanks
Are you using SQLAlchemy? If so, SQLAlchemy will always commit automatically (see e.g. here) You could however use the engine.begin context manager to roll back any commits upon failure:
with engine.begin() as conn:
df.to_sql(name= 'test1',schema='test', con=conn)