I tried session.bind.dispose() and NullPool. But engine *is still not 
cleared*. It still seems to have some reference from SessionEventsDispatch 
=> sqlalchemy.event._DispatchDescriptor.



On Friday, 11 January 2013 05:24:19 UTC+5:30, Michael Bayer wrote:
>
>
> On Jan 10, 2013, at 8:25 AM, 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.
>
>
>
> engines can be disposed using engine.dispose() to close connections 
> referred to by the pool, and then removing all references to that engine.
>
> if you aren't concerned about connection pooling (which seems to be the 
> case here if you're looking to dispose engines regularly) then just use 
> NullPool with create_engine(..., pool_class=NullPool).   Then dispose() 
> isn't really needed, just lose references to the engine.
>
>
>
>
>
>
>
>
>
> -- 
> 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/-/bTtgyK4eAy4J.
> To post to this group, send email to [email protected]<javascript:>
> .
> To unsubscribe from this group, send email to 
> [email protected] <javascript:>.
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/xtb_18kV1ZUJ.
To post to this group, send email to [email protected].
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.

Reply via email to