On Oct 24, 2006, at 9:49 AM, dmiller wrote:
> QueuePool.dispose() # closes all open connections
>
> The problem is getting to the pool instance to call that method...
>
> metadata.engine.connection_provider._pool.dispose()
>
> I have to access a private member to do that--ouch! Maybe the engine
> and/or the metadata could have a method something like this:
>
> engine.close_all_connections()
>
> I wouldn't call it "dispose()" since that sounds permanent, like it
> might not allow any new connections after the method is invoked. What
> do you think?
I think technically if you just call dispose() on the engine, all its
doing is calling dispose() on the underlying pool....and if you
continue using the engine, it will do exactly what youre looking
for. (also ConnectionProvider has a dispose() method too).
So, we can consider renaming "dispose()" to "close_all_connections()"
or something like that.
Also, with the normal QueuePool, the connections have to be checked
in to the pool when dispose() is called, else they wont get closed.
if thats a problem, we can look into enhancing that.
I just checked in this patch that will log the actual closing of the
connections....feel free to SVN up and confirm the behavior for me if
you have some time....
Index: lib/sqlalchemy/pool.py
===================================================================
--- lib/sqlalchemy/pool.py (revision 2044)
+++ lib/sqlalchemy/pool.py (working copy)
@@ -130,6 +130,7 @@
self.__pool = pool
self.connection = self.__connect()
def close(self):
+ self.__pool.log("Closing connection %s" % repr
(self.connection))
self.connection.close()
def invalidate(self):
self.__pool.log("Invalidate connection %s" % repr
(self.connection))
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---