the sessionmaker() object is not GC-able in 0.7 right now due to event 
mechanics.   This issue does not exist in 0.8.   I'll add a note.



On Jan 11, 2013, at 1:18 AM, Michael Bayer wrote:

> there's some side effect occurring as a result of how 0.7 creates a new 
> subclass when using sessionmaker.  Since you don't need a sessionmaker here, 
> please use this form:
> 
> return Session(bind=engine, expire_on_commit=False)
> 
> or upgrade to 0.8.0b2.
> 
> 
> 
> On Jan 11, 2013, at 1:08 AM, Anoop K wrote:
> 
>> I tried the code in my setup.(SQLAlchemy-0.7.8-py2.6). Looks like engine did 
>> not got GCed.
>> 
>> [anoop@localhost tmp]$ p engtest.py 
>> about to delete sn...
>> about to gc.collect()...
>> Traceback (most recent call last):
>>   File "engtest.py", line 31, in <module>
>>     assert engine_is_removed
>> AssertionError
>> 
>> 
>> 
>> On Thursday, 10 January 2013 18:55:59 UTC+5:30, Anoop K wrote:
>> It seems engine created using create_engine is not freed after cleanup of a 
>> session. Object graph indicates that event.listen for pool is holding 
>> reference to engine even after session is garbage collected.
>> What is the right way/api to delete an engine ?
>> 
>> UseCase
>> As there are lot of databases in multiple boxes whose ip/user/password can 
>> change I would like to destroy session and engine after use. Cost of 
>> creating/closing connection can be ignored for my use case.
>> 
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/sqlalchemy/-/RWBNo1sT1ogJ.
>> 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.
> 
> 
> -- 
> 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.

-- 
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