RE: [sqlalchemy] Keeping open connections alive

2012-12-23 Thread Alexey Vihorev
Thank you, I'll try that. From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Sunday, December 23, 2012 6:42 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Keeping open connections alive if you want to go that route I'd use t

Re: [sqlalchemy] Keeping open connections alive

2012-12-23 Thread Michael Bayer
if you want to go that route I'd use the connection events to hit every DBAPI connection as it's created, and store them in a weak-referencing collection: import weakref from sqlalchemy import event from sqlalchemy.engine import Engine connections = weakref.WeakKeyDictionary() @event.listens_fo

[sqlalchemy] Keeping open connections alive

2012-12-23 Thread Alexey Vihorev
Hi, all! I've got a problem in my GUI app - if a connection stayes open for too long, and is inactive (user opened an editing window and went away for a cofee brake etc), firewall/other network machinery will close the connection and the session will fail with 'connection abnormally terminated'. S