I'm using SA to talk to a MySQL database, but the database has a
tendency to drop my connection while the queries are running.

SQLError: (OperationalError) (2013, 'Lost connection to MySQL server
during query') 'SELECT sum(bgp_churn.count) \nFROM bgp_churn \nWHERE
bgp_churn.tstamp > %s AND bgp_churn.type = %s \n LIMIT 1'
[1158084083.0, 'U']

This isn't a particularly big deal for my application, I'm caching the
results and can just retry a minute or two later. Unfortunately, this
IS a big deal to SQLAlchemy. Frequently, but not always, it gets into
a state where every query after this results in a 'Commands out of
sync' message.

SQLError: (ProgrammingError) (2014, "Commands out of sync; you can't
run this command now") 'SELECT bgp_churn.asn, sum(bgp_churn.count) AS
count \nFROM bgp_churn \nWHERE bgp_churn.tstamp > %s AND
bgp_churn.type = %s GROUP BY bgp_churn.asn ORDER BY count DESC \n
LIMIT 4' [1158089885.0, 'U'

Here's the MySQL manual page on this error:

http://dev.mysql.com/doc/refman/4.1/en/commands-out-of-sync.html

The strange thing is that this does not occur consistently. It seems
to occur less frequently when echo is on but that might be a placebo
on my part.


In any event, I'd appreciate suggestions on how to clean up after
losing a connection. I figure that if I can kill the entire pool and
reconnect to the database, I'll be fine. I just can't figure out how
to do that through the SQLAlchemy API.

I've been poking at this error for a few weeks trying to come up with
a reduced test case but I can't get it to occur in anything but my
full TurboGears application (the intermittency doesn't help). Any
advice would be appreciated.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to