How to find bad row with db api executemany()?

Roy Smith roy at panix.com
Fri Mar 29 15:48:28 CET 2013


I'm inserting a gazillion rows into a MySQL database using MySQLdb and cursor.executemany() for efficiency.  Every once in a while, I get a row which violates some kind of database constraint and raises Error.

I can catch the exception, but don't see any way to tell which row caused the problem.  Is this information obtainable, short of retrying each row one by one?

---
Roy Smith
roy at panix.com





More information about the Python-list mailing list