MySQLDB - server has gone on blob insertion...

Durumdara durumdara at gmail.com
Wed May 26 05:30:41 EDT 2010


Hi!

I want to test my program that coded into PGSQL, and PySQLite. With these
DBs I have problem on many blob deletion (2 hours) and compact/vacuum (1
hours)...

So I'm trying to port my program, and before that making a test to check,
which time needs to delete 1 GB of blobs.

I installed MySQLDb from the exe (Py2.6, from stackoverflow version), set
all parameters, etc.

import MySQLdb

conn = MySQLdb.connect (host = "localhost",
user = "root",
  passwd = "",
  db = "db")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")

cursor.execute('delete from blobs;')

s = time.time()
for i in range(200):
   k = str(i)
   xbuffer = chr(65 + (i % 26))
   xbuffer = xbuffer * 1024 * 1024
   b = MySQLdb.escape_string(xbuffer)
   print len(b)
   cursor.execute('''insert into blobs
    (blob_id, file_id, size, ext, data)
    values
    (%s, %s, %s, %s, %s)''', (i, i, -1, 'org', b))
   conn.commit()
e = time.time()
t = e - s
print t

sys.exit()

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.

But: I can insert 800k-1,9 MB blobs.

I tried to set this parameter, but nothing changed.
My.ini:

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

max_allowed_packet = 16M

# The TCP/IP Port the MySQL Server will listen on
port=3306

What is the problem? What I do wrong?

Thanks for your help:
   dd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100526/52656611/attachment.html>


More information about the Python-list mailing list