MySQLdb executemany
Daniel Bowett
daniel at bowettsolutions.com
Wed Jan 26 17:16:57 EST 2005
Daniel Bowett wrote:
> 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???
>
UPDATE
------
The maximum packet size in mysql by default is 1MB. Hence why I was
hitting ths problem.
http://dev.mysql.com/doc/mysql/en/packet-too-large.html
More information about the Python-list
mailing list