DBAPI connections typically know how to disconnect when they're deleted, as do 
socket connections, so there's not particularly any kind of "cleanup" needed 
when an application exits.

The one kind of warning you can get on app exit are weakref warnings, for 
connections that haven't been returned to the connection pool.   These warnings 
are of course entirely harmless, but to avoid them you can make sure all 
connections are back in the pool, with the ORM this means any Session object 
has been completed with commit(), rollback(), or close().  If using the Core is 
means all Connection and ResultProxy objects have been closed.

engine.dispose() will actively close out connections that are present in the 
pool and not checked out, but this is mostly to help with test suites that 
setup/teardown lots of engines as well as when the database has been restarted 
to flush the entire connection pool.



On Mar 2, 2012, at 11:58 AM, Michael Hipp wrote:

> Is there anything that should be done to close an engine just before 
> application termination?
> 
> I don't see a .close() method but there is a .dispose() method.
> 
> Thanks,
> Michael
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> 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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
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