Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-11 Thread Michael Bayer
there's no class level GC cycle when dealing with the Session object, no, this bug is local to the ad-hoc subclass mechanism of sessionmaker(). On Jan 11, 2013, at 2:01 AM, Anoop K wrote: OK. So does Session(bind=engine, expire_on_commit=False) usage always guarantee that engine and

[sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Anoop K
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*

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Michael Bayer
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:

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Anoop K
*Great ...* Session(bind=engine, expire_on_commit=False) fixed the problem. Looks like 0.8.0b2 is BETA. Is it OK to use in production ? Thanks Anoop On Friday, 11 January 2013 11:48:29 UTC+5:30, Michael Bayer wrote: there's some side effect occurring as a result of how 0.7 creates a new

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Michael Bayer
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

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Michael Bayer
its beta very close to release On Jan 11, 2013, at 1:29 AM, Anoop K wrote: Great ... Session(bind=engine, expire_on_commit=False) fixed the problem. Looks like 0.8.0b2 is BETA. Is it OK to use in production ? Thanks Anoop On Friday, 11 January 2013 11:48:29 UTC+5:30, Michael Bayer

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Michael Bayer
the event mechanics issue applies to 0.7 and 0.8. while the engine will be gc'ed in 0.8, the sessionmaker itself, if used, will still create an anonymous subclass that is not cleared. creating many ad-hoc sessionmaker() objects, while this was not its intended use, will cause memory to

Re: [sqlalchemy] Re: SQLAlchemy Engine cleanup

2013-01-10 Thread Anoop K
OK. So does Session(bind=engine, expire_on_commit=False) usage always guarantee that engine and all other associated objects are cleared on doing a session.close() + engine.dispose(). On Friday, 11 January 2013 12:27:16 UTC+5:30, Michael Bayer wrote: the event mechanics issue applies to