MySQL has gone - with python and blobs

MySQL has gone - with python and blobs

am 01.06.2010 19:37:17 von durumdara

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 need 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


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: MySQL has gone - with python and blobs

am 01.06.2010 22:32:49 von mos

See http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

Mike

At 12:37 PM 6/1/2010, durumdara wrote:
>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 need 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
>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=mos99@fastmail.fm


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org