MySQLDB - server has gone on blob insertion...

John Nagle nagle at animats.com
Thu May 27 20:37:44 EDT 2010


Dennis Lee Bieber wrote:
> On Wed, 26 May 2010 11:30:41 +0200, Durumdara <durumdara at gmail.com>
> declaimed the following in gmane.comp.python.general:
> 
>> cursor.execute('delete from blobs;')
>>
> 	Since that statement will delete EVERY record from the table
> "blobs", I believe it is common practice to replace it with
> 
> drop table blobs
> create table blobs (whatever definition it had originally)

    No, it's not "common practice".  Actually, the proper way
to clear a table is "TRUNCATE TABLE tablename;"

    Note that deleting a table referenced by other tables using FOREIGN KEY
can be rejected by the database.

					John Nagle
>  
>> When I tried to start this, I got error:
>>
>> _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
>>
>> I read that server have some parameter, that limit the Query length.
>>
>> Then I decreased the blob size to 1M, and then it is working.
>>
> 	What is the table definition? In MySQL 4 (and likely not changed in
> v5 -- I've got the old brown tree book handy, hence the mention of v4)
> field type BLOB is limited to a length of 2^16 (64kB), MEDIUMBLOB is
> 2^24, and LONGBLOB is 2^32 (if the system is using unsigned integers
> internally, that should support 4GB... But do you have enough memory to
> pass such an argument? <G>).



More information about the Python-list mailing list