class _ConnectionFairy(object):
Proxies a DBAPI connection and provides return-on-dereference support.
This is an internal object used by the _pool.Pool
implementation
to provide context management to a DBAPI connection delivered by
that _pool.Pool
.
The name "fairy" is inspired by the fact that the
._ConnectionFairy
object's lifespan is transitory, as it lasts
only for the length of a specific DBAPI connection being checked out from
the pool, and additionally that as a transparent proxy, it is mostly
invisible.
See Also
._ConnectionRecord
Class Method | _checkout |
Undocumented |
Method | __getattr__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | _checkin |
Undocumented |
Method | _checkout_existing |
Undocumented |
Method | _close_no_reset |
Undocumented |
Method | _reset |
Undocumented |
Method | close |
Undocumented |
Method | connection.setter |
Undocumented |
Method | cursor |
Return a new DBAPI cursor for the underlying connection. |
Method | detach |
Separate this connection from its Pool. |
Method | invalidate |
Mark this connection as invalidated. |
Instance Variable | _connection_record |
A reference to the ._ConnectionRecord object associated with the DBAPI connection. |
Instance Variable | _echo |
Undocumented |
Instance Variable | dbapi_connection |
A reference to the actual DBAPI connection being tracked. |
Instance Variable | info |
Info dictionary associated with the underlying DBAPI connection referred to by this .ConnectionFairy , allowing user-defined data to be associated with the connection. |
Property | _logger |
Undocumented |
Property | connection |
An alias to ._ConnectionFairy.dbapi_connection . |
Property | driver_connection |
The connection object as returned by the driver after a connect. |
Property | is_valid |
Return True if this ._ConnectionFairy still refers to an active DBAPI connection. |
Property | record_info |
Info dictionary associated with the ._ConnectionRecord container referred to by this `.ConnectionFairy . |
Return a new DBAPI cursor for the underlying connection.
This method is a proxy for the connection.cursor() DBAPI method.
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 DB-API connection, and will create a new connection when next used.
Note that any overall connection limiting constraints imposed by a Pool implementation may be violated after a detach, as the detached connection is removed from the pool's knowledge and control.
Mark this connection as invalidated.
This method can be called directly, and is also called as a result
of the _engine.Connection.invalidate
method. When invoked,
the DBAPI connection is immediately closed and discarded from
further use by the pool. The invalidation mechanism proceeds
via the ._ConnectionRecord.invalidate
internal method.
See Also
Parameters | |
e | an exception object indicating a reason for the invalidation. |
soft | if True, the connection isn't closed; instead, this connection will be recycled on next checkout.
New in version 1.0.3.
|
A reference to the ._ConnectionRecord
object associated
with the DBAPI connection.
This is currently an internal accessor which is subject to change.
A reference to the actual DBAPI connection being tracked.
See Also
._ConnectionFairy.driver_connection
._ConnectionRecord.dbapi_connection
Info dictionary associated with the underlying DBAPI connection
referred to by this .ConnectionFairy
, allowing user-defined
data to be associated with the connection.
The data here will follow along with the DBAPI connection including
after it is returned to the connection pool and used again
in subsequent instances of ._ConnectionFairy
. It is shared
with the ._ConnectionRecord.info
and
_engine.Connection.info
accessors.
The dictionary associated with a particular DBAPI connection is discarded when the connection itself is discarded.
An alias to ._ConnectionFairy.dbapi_connection
.
This alias is deprecated, please use the new name.
The connection object as returned by the driver after a connect.
See Also
._ConnectionFairy.dbapi_connection
._ConnectionRecord.driver_connection
._ConnectionFairy
still refers
to an active DBAPI connection.Info dictionary associated with the ._ConnectionRecord
container referred to by this `.ConnectionFairy
.
Unlike the ._ConnectionFairy.info
dictionary, the lifespan
of this dictionary is persistent across connections that are
disconnected and/or invalidated within the lifespan of a
._ConnectionRecord
.