I am developing a program in Python that accesses a MySQL database using MySQLdb. In certain situations, I have to run an INSERT or REPLACE command on many rows. I am curren
Strongly do not recommend to use executeMany
in pyodbc
as well as ceodbc
both slow and contains a lot of bugs.
Instead consider use execute
and manually construct SQL
query using simple string format.
transaction = "TRANSACTION BEGIN {0} COMMIT TRANSACTION
bulkRequest = ""
for i in range(0, 100)
bulkRequest = bulkRequest + "INSERT INTO ...... {0} {1} {2}"
ceodbc.execute(transaction.format(bulkRequest))
Current implementation is very simple fast and reliable.