diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-05-10 15:56:31 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-05-10 15:56:31 +0000 |
| commit | 48648eedda50a84f5518ac2055286e1fde22fa00 (patch) | |
| tree | 8b80e4935f2df811d1ef510e179a1e6c38d77b57 /lib/sqlalchemy/pool.py | |
| parent | 98207edf309c58198b6b1700776fc415a6bcac19 (diff) | |
| download | sqlalchemy-48648eedda50a84f5518ac2055286e1fde22fa00.tar.gz | |
propigated detach() and invalidate() methods to Connection.
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 6ad560e5b..8915b8098 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -258,6 +258,11 @@ class _ConnectionFairy(object): is_valid = property(lambda self:self.connection is not None) def invalidate(self, e=None): + """Mark this connection as invalidated. + + The connection will be immediately closed. The + containing ConnectionRecord will create a new connection when next used. + """ if self.connection is None: raise exceptions.InvalidRequestError("This connection is closed") if self._connection_record is not None: @@ -284,6 +289,14 @@ class _ConnectionFairy(object): return self def detach(self): + """Separate this Connection from its Pool. + + This means that the connection will no longer be returned to the + pool when closed, and will instead be literally closed. The + containing ConnectionRecord is separated from the DBAPI connection, and + will create a new connection when next used. + """ + if self._connection_record is not None: self._connection_record.connection = None self._pool.do_return_conn(self._connection_record) |
