MySQLdb executemany

Daniel Bowett daniel at
Wed Jan 26 13:42:14 EST 2005

I seem to have found a bug/limitation of executemany in MySQLdb.

I am inserting 3100 records into a database. It works fine and adds them 
in about 1 second.

I went back to the program today and realised i'd missed a field so 
added it to the insert statement. This seems to break it if I try to add 
all the records in one go. Through trial and error I have realised the 
limit is 2786 records in one go. Any more than that I get two different 
errors on the executemany statement:

"MySQL server has gone away" - This occurs if I try to add all 3100 
records in one go.

"Lost Connection to MySQL server during query" - This happens if I am 
near the 2786 threshold.

Is there a known limit with this function???

More information about the Python-list mailing list