diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-02 16:33:54 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-02 16:33:54 -0500 |
commit | 0326f3cf014ffb4928b4c6051d2fca13cb6945d7 (patch) | |
tree | 0f3585321eccf6ba5b7cd97f38490f8c2650ccd5 /lib/sqlalchemy/engine/base.py | |
parent | 4ed4266803cbba480e5785103302eba5b5a86652 (diff) | |
download | sqlalchemy-0326f3cf014ffb4928b4c6051d2fca13cb6945d7.tar.gz |
- Added :paramref:`.MetaData.reflect.**dialect_kwargs`
to support dialect-level reflection options for all :class:`.Table`
objects reflected.
- Added a new dialect-level argument ``postgresql_ignore_search_path``;
this argument is accepted by both the :class:`.Table` constructor
as well as by the :meth:`.MetaData.reflect` method. When in use
against Postgresql, a foreign-key referenced table which specifies
a remote schema name will retain that schema name even if the name
is present in the ``search_path``; the default behavior since 0.7.3
has been that schemas present in ``search_path`` would not be copied
to reflected :class:`.ForeignKey` objects. The documentation has been
updated to describe in detail the behavior of the ``pg_get_constraintdef()``
function and how the ``postgresql_ignore_search_path`` feature essentially
determines if we will honor the schema qualification reported by
this function or not. [ticket:2922]
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 1f2b7a3e5..888a15fee 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -353,17 +353,26 @@ class Connection(Connectable): def detach(self): """Detach the underlying DB-API connection from its connection pool. - This Connection instance will remain usable. When closed, + E.g.:: + + with engine.connect() as conn: + conn.detach() + conn.execute("SET search_path TO schema1, schema2") + + # work with connection + + # connection is fully closed (since we used "with:", can + # also call .close()) + + This :class:`.Connection` instance will remain usable. When closed + (or exited from a context manager context as above), the DB-API connection will be literally closed and not - returned to its pool. The pool will typically lazily create a - new connection to replace the detached connection. + returned to its originating pool. This method can be used to insulate the rest of an application from a modified state on a connection (such as a transaction - isolation level or similar). Also see - :class:`~sqlalchemy.interfaces.PoolListener` for a mechanism to modify - connection state when connections leave and return to their - connection pool. + isolation level or similar). + """ self.__connection.detach() |