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")
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")