I've created a full test case that should reproduce the error for you.
You'll need to create a database called 'test' on your local machine.
I think I've isolated the problem to the use of the creator keyword
argument, which I use in my application for various reasons.
def setup(**kwargs):
connection = MySQLdb.connections.Connection(**kwargs)
engine = create_engine('mysql://', creator=lambda: connection,
pool_recycle=2)
the creator argument is a callable that returns a new connection
when the pool needs one. Above, you are pre-connecting a
Oh, I see. I was unaware that lambda evaluated the result only once,
not each use. Thanks so much for your help.
On Dec 19, 4:36 pm, Michael Bayer mike...@zzzcomputing.com wrote:
def setup(**kwargs):
connection = MySQLdb.connections.Connection(**kwargs)
engine =
oh, whoops, shouldnt be a lambda there:
def setup(**kwargs):
def connect():
return MySQLdb.connections.Connection(**kwargs)
engine = create_engine('mysql://', creator=connect,
pool_recycle=2)
On Dec 19, 2008, at 6:56 PM, Ken wrote:
Oh, I see. I was unaware that
On Dec 17, 9:24 am, Michael Bayer mike...@zzzcomputing.com wrote:
yes but pool_recycle is documented as a number of seconds, and a
typical value is 3600 for one hour. setting it to True means it will
recycle the connection every second. Technically, that shouldn't
cause any broken
On Dec 18, 2008, at 11:51 AM, Ken wrote:
On Dec 17, 9:24 am, Michael Bayer mike...@zzzcomputing.com wrote:
yes but pool_recycle is documented as a number of seconds, and a
typical value is 3600 for one hour. setting it to True means it will
recycle the connection every second.
On Dec 17, 2008, at 10:10 AM, Ken wrote:
Actually, I found that the error goes away if I don't set
pool_recycle=True. However, I'm told pool_recycle is necessary to
prevent MySQL has gone away errors.
yes but pool_recycle is documented as a number of seconds, and a
typical value is 3600
Actually, I found that the error goes away if I don't set
pool_recycle=True. However, I'm told pool_recycle is necessary to
prevent MySQL has gone away errors. My guess then is that SQLAclehmy
preparing a statement, it works right the first time, and thereafter
there is an issue with it.
So