summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-05-15 16:12:14 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-05-15 16:12:14 -0400
commit28aa32a20d71d582257c5f3c1f0cccb4d7f0f85c (patch)
tree5c8de32ad79ccd8e5a9ca3e9bcab068df80090d0 /lib/sqlalchemy/engine/base.py
parent4fe3d83df50bbd9428e330995890f00d55c3cd74 (diff)
downloadsqlalchemy-28aa32a20d71d582257c5f3c1f0cccb4d7f0f85c.tar.gz
docs on dispose
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index dea13e16c..e9d4f0471 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -1493,6 +1493,29 @@ class Engine(Connectable, log.Identified):
return 'Engine(%s)' % str(self.url)
def dispose(self):
+ """Dispose of the connection pool used by this :class:`Engine`.
+
+ A new connection pool is created immediately after the old one has
+ been disposed. This new pool, like all SQLAlchemy connection pools,
+ does not make any actual connections to the database until one is
+ first requested.
+
+ This method has two general use cases:
+
+ * When a dropped connection is detected, it is assumed that all
+ connections held by the pool are potentially dropped, and
+ the entire pool is replaced.
+
+ * An application may want to use :meth:`dispose` within a test
+ suite that is creating multiple engines.
+
+ It is critical to note that :meth:`dispose` does **not** guarantee
+ that the application will release all open database connections - only
+ those connections that are checked into the pool are closed.
+ Connections which remain checked out or have been detached from
+ the engine are not affected.
+
+ """
self.pool.dispose()
self.pool = self.pool.recreate()