python, Mysql_python, storm problem

P

paul Batoum.

I am actually tryng to build a database apps in python + storm which use
MySQLdb 1.2.2
i actually want the auto reconnect feature of storm, which just need to
change the False param of raw_connect to True in storm/databases/mysql.py so
far nothing really difficult but from there i got quite a weird result:

if i try the following code, it works in the shell python interpreter but
not when i put it in a test.py file and call it as python test.py (will be
helpfull for unittest):

So to make it simple the MySQL reconnect work in the shell interpreter and i
got a DisconnectionError: (2006, 'MySQL server has gone away') when i use it
the other way.

Let me know if one of you have ever experienced something like that

Thx

Code:

import database
import time

# Test timeout cases
pdb = database.Database(connect_info)
res = pdb.execute(u"SHOW VARIABLES LIKE 'wait_timeout'")
# set the timeout to 3 sec
pdb.execute("SET wait_timeout=3")
res = pdb.execute(u"SHOW VARIABLES LIKE 'wait_timeout'")
res = pdb.execute("select * from country")
time.sleep(5)
# try a new execute, this one should pass
res = pdb.execute("select * from country")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top