I'm restarting it after the first fetchall() finishes. My experience with postgresql/psycopg2 is that you can tell the connection is dead when you next try to call cursor(), but that isn't happening here because of the queue problem I described.
Here's the output with pool logging on, if that helps: >>> e = create_engine('postgres://[EMAIL PROTECTED]/mozy', pool_size=1, max_overflow=0, pool_timeout=None, echo=True) >>> e.execute('select 1').fetchall() >>> 2007-01-25 15:03:10,704 INFO sqlalchemy.pool.QueuePool.0x..b4 Created new connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> INFO:sqlalchemy.pool.QueuePool.0x..b4:Created new connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> 2007-01-25 15:03:10,704 INFO sqlalchemy.pool.QueuePool.0x..b4 Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> checked out from pool INFO:sqlalchemy.pool.QueuePool.0x..b4:Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> checked out from pool 2007-01-25 15:03:10,705 INFO sqlalchemy.engine.base.Engine.0x..14 select 1 INFO:sqlalchemy.engine.base.Engine.0x..14:select 1 2007-01-25 15:03:10,705 INFO sqlalchemy.engine.base.Engine.0x..14 None INFO:sqlalchemy.engine.base.Engine.0x..14:None 2007-01-25 15:03:10,709 INFO sqlalchemy.pool.QueuePool.0x..b4 Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> being returned to pool INFO:sqlalchemy.pool.QueuePool.0x..b4:Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> being returned to pool [(1,)] # [db restarted] >>> e.execute('select 1').fetchall() 2007-01-25 15:03:30,690 INFO sqlalchemy.pool.QueuePool.0x..b4 Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> checked out from pool INFO:sqlalchemy.pool.QueuePool.0x..b4:Connection <connection object at 0xb79ca020; dsn: 'dbname=mozy host=db user=neptune', closed: 0> checked out from pool 2007-01-25 15:03:30,691 INFO sqlalchemy.engine.base.Engine.0x..14 select 1 INFO:sqlalchemy.engine.base.Engine.0x..14:select 1 2007-01-25 15:03:30,691 INFO sqlalchemy.engine.base.Engine.0x..14 None INFO:sqlalchemy.engine.base.Engine.0x..14:None Traceback (most recent call last): File "<stdin>", line 1, in ? File "/root/SQLAlchemy-0.3.4/lib/sqlalchemy/engine/base.py", line 686, in fetchall for row in self.cursor.fetchall(): psycopg2.ProgrammingError: no results to fetch >>> e.execute('select 1').fetchall() # [hangs] On 1/25/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > if you close all connections (i.e. return them all to the pool), and > then go to get them again, it can handle a restart *if* the dialect > knows how to detect the conditions whereby it should invalidate() the > connections. which is generally pretty spotty, i dont think PG knows > how to do it. also i dont understand the error condition you are > getting, the connections should all be getting returned above ( or some > exception would be thrown). > > are you stopping the DB while the first fetchall() is executing ? or > in between ? > > > On Jan 25, 3:54 pm, "Jonathan Ellis" <[EMAIL PROTECTED]> wrote: > > from sqlalchemy import * > > e = create_engine('postgres://...', pool_size=1, max_overflow=0, > > pool_timeout=None) > > e.execute('select 1').fetchall() > > # restart db > > e.execute('select 1').fetchall() > > # error gets raised, ConnectionRecord apparently doesn't get returned > > to pool because: > > e.execute('select 1').fetchall() > > # hangs, pool overflow=1 (so new CR is not created) but nothing is in the > > queue > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---