On Apr 9, 2012, at 8:24 PM, Mitchell Hashimoto wrote:

> 
> 
> On Monday, April 9, 2012 12:03:29 PM UTC-7, Michael Bayer wrote:
> close your connections after you are finished with them.
> 
> So I suppose my confusion is where is the "connection" being made. I have a 
> singleton engine instance running around, and when I query, I basically do 
> something like this:
> 
> query = select([fields])
> result = engine.execute(query).fetchall()
> 
> Therefore I'm using implicit connections. The reference to the ResultProxy is 
> quickly gone, which I thought would implicitly close the connection as well.
> 
> What exactly am I supposed to do here?

That pattern will return the connection to the pool immediately after use - so 
for that to be the only pattern at play, you'd have to have some execute() or 
fetchall() calls that are taking so long to complete that concurrent executions 
are timing out.   You'd want to look at any processes/threads hanging or taking 
very long and causing other concurrent connections to time out.

If you aren't using threads or concurrency, and expect that only one connection 
should be in use at a time for a given engine, then I'd give the AssertionPool 
a quick try which will ensure you're only checking out one connection at a 
time, illustrating a stack trace where a second concurrent checkout would be 
occurring.


-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to