Speeding up pandas.DataFrame.to_sql with fast_executemany of pyODBC

EDIT (2019-03-08): Gord Thompson commented below with good news from the update logs of sqlalchemy: Since SQLAlchemy 1.3.0, released 2019-03-04, sqlalchemy now supports engine = create_engine(sqlalchemy_url, fast_executemany=True) for the mssql+pyodbc dialect. I.e., it is no longer necessary to define a function and use @event.listens_for(engine, ‘before_cursor_execute’) Meaning the below function can be removed and only the … Read more