Largest possible size for executemany() in PEP-249 (Database API)

Roy Smith roy at panix.com
Thu Feb 28 18:05:28 CET 2013


I'm trying to batch up inserts to a database using MySQLdb.  When I
get to something over 10,000 records per call, I get an exception:

_mysql_exceptions.OperationalError: (1153, "Got a packet bigger than
'max_allowed_packet' bytes")

Is there any way (other than trial and error) to know how many records
I can pass in one call before I blow up?  As a practical matter, if I
do batches of 1000 per call, I've probably gotten as much performance
enhancement as I need, but it would be nice to know if there's a
useful way to determine exactly what the maximum is.



More information about the Python-list mailing list