Tina Bu
1 min readFeb 4, 2020

--

Hi Andrea! Sorry for my late reply. Yes, if you are writing a lot of data to Azure DB then you should use execute_many:

conn = pyodbc.connect(settings.CONNECTION_STRING)
cursor = conn.cursor()
data = [tuple(col for col in row) for row in df.values]
cursor.fast_executemany = True # new in pyodbc 4.0.19
cursor.executemany(insert_query, data)
conn.commit()

Let me know if this helps!

--

--

Tina Bu
Tina Bu

Responses (1)