Faster ways to transfer results from a dataframe to SQL Server?

62 Views Asked by At

I'm trying to upload 13,000 rows to a SQL Server 2019 (v15.0.5893) using Python.

It takes about three minutes, which seems unreasonably long, and I'm sure it could be done faster. I am using SQLAlchemy. Is there a faster way?

quoted = urllib.parse.quote_plus("DRIVER={SQL Server};SERVER=......;DATABASE=.....")
engine = create_engine('mssql+pyodbc:///?odbc_connect={}'.format(quoted))
try:
    print ('uploading...')
    dataFrame.to_sql("MyTable", schema='dbo', con=engine, if_exists='replace', chunksize=1000)
0

There are 0 best solutions below