Python dataframe how to load it into sql server faster than row by row?

  pandas, pyodbc, python

My problem is that I am loading 50 000 rekord into the database row by row and it is very slow. (10 min)

I receive the data from an api in json format than format it into dataframe and insert it into database row by row like this .

for index, Row in DFToInsert.iterrows():
try:
cursor.execute("INSERT INTO …

And it works fine but it is very slow.

Is there any chance to load it faster ?
I am using pyodbc and pandas .

Source: Python Questions

LEAVE A COMMENT