I thought at one time that calling create_engine multiple times with the same 
connection string would return the same engine.

Now it seems that I get  a different engine each time, and hence a different 
connection pool, so my Paste based application eventually consumes all 
available 
database connections (firebird)

Also, I think when an engine is garbage collected, it's not closing the 
connections 
in the pool.

At least in my case, I was only saving the most recently returned value from 
create_engine on each web request.. and I was getting a new pool every time.. 

Yet firebird connections never got closed even though those connections were 
returned to the pool. (checked using echo_pool=True)

Are engines referenced somewhere else in sqlalchemy, hence keeping them 
from being garbage collected?

I see the same symptoms using plain or threadlocal strategy.

I am using explicit code in wsgi middleware to handle transactions

engine = some_user_method
connection = engine.connect
trans = connection.begin
session = create_session(bind_to=connection)

.. 

later I 

trans.commit()
connection.close()
discard references to session, trans and connection
(I don't keep a reference to the engine)

--

So back to the original question, did at one time create_engine return the same 
engine object for same connection string?  



-- 
Brad Clements,                [EMAIL PROTECTED]    (315)268-1000
http://www.murkworks.com                          
AOL-IM or SKYPE: BKClements



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to