Re: [SQLObject] OperationalError: (2006, 'MySQL server has gone away') Why?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: sophana <so...@zi...> - 2006-08-02 20:57:49
|
I will try the patch below. Has anybody tried it? This feature seems to be a must-have, don't you think? gentoo sqlobject # diff -Nura dbconnection.py.orig dbconnection.py --- dbconnection.py.orig 2006-07-26 23:21:23.000000000 +0800 +++ dbconnection.py 2006-07-27 00:12:44.000000000 +0800 @@ -214,11 +214,27 @@ self._binaryType =3D type(self.module.Binary('')) def _runWithConnection(self, meth, *args): + try: + import _mysql_exceptions + except ImportError: + MySQLdbExcept =3D ImportError + else: + MySQLdbExcept =3D _mysql_exceptions.OperationalError + conn =3D self.getConnection() try: val =3D meth(conn, *args) - finally: + except MySQLdbExcept: + #print "make reconnection" self.releaseConnection(conn) + conn =3D self.makeConnection() + self._connectionNumbers[id(conn)] =3D self._connectionCount + self._connectionCount +=3D 1 + try: + val =3D meth(conn, *args) + finally: + self.releaseConnection(conn) + #finally: return val def getConnection(self): Jorge Vargas a =E9crit : > On 8/2/06, *sophana* <so...@zi... > <mailto:so...@zi...>> wrote: > > hi I don't have a direct answer to you but this is a known problem, > and is recurrent in Turbogears (we use SQLObject for the backend) > please follow the discussion here. > > http://trac.turbogears.org/turbogears/ticket/781 > http://trac.turbogears.org/turbogears/ticket/872 > <http://trac.turbogears.org/turbogears/ticket/872> > > if you browser the TG mailing you will find a couple of workarounds > > |