class _ConnectionRecord(object):
Internal object which maintains an individual DBAPI connection
referenced by a _pool.Pool
.
The ._ConnectionRecord
object always exists for any particular
DBAPI connection whether or not that DBAPI connection has been
"checked out". This is in contrast to the ._ConnectionFairy
which is only a public facade to the DBAPI connection while it is checked
out.
A ._ConnectionRecord
may exist for a span longer than that
of a single DBAPI connection. For example, if the
._ConnectionRecord.invalidate
method is called, the DBAPI connection associated with this
._ConnectionRecord
will be discarded, but the ._ConnectionRecord
may be used again,
in which case a new DBAPI connection is produced when the
_pool.Pool
next uses this record.
The ._ConnectionRecord
is delivered along with connection
pool events, including _events.PoolEvents.connect
and
_events.PoolEvents.checkout
, however ._ConnectionRecord
still
remains an internal object whose API and internals may change.
See Also
._ConnectionFairy
Class Method | checkout |
Undocumented |
Method | __close |
Undocumented |
Method | __connect |
Undocumented |
Method | __init__ |
Undocumented |
Method | _checkin_failed |
Undocumented |
Method | _is_hard_or_soft_invalidated |
Undocumented |
Method | checkin |
Undocumented |
Method | close |
Undocumented |
Method | connection.setter |
Undocumented |
Method | get_connection |
Undocumented |
Method | invalidate |
Invalidate the DBAPI connection held by this ._ConnectionRecord . |
Instance Variable | __pool |
Undocumented |
Instance Variable | _soft_invalidate_time |
Undocumented |
Instance Variable | dbapi_connection |
A reference to the actual DBAPI connection being tracked. |
Instance Variable | fairy_ref |
Undocumented |
Instance Variable | finalize_callback |
Undocumented |
Instance Variable | fresh |
Undocumented |
Instance Variable | starttime |
Undocumented |
Property | connection |
An alias to ._ConnectionRecord.dbapi_connection . |
Property | driver_connection |
The connection object as returned by the driver after a connect. |
Property | in_use |
Undocumented |
Property | info |
The .info dictionary associated with the DBAPI connection. |
Property | last_connect_time |
Undocumented |
Property | record_info |
An "info' dictionary associated with the connection record itself. |
Invalidate the DBAPI connection held by this
._ConnectionRecord
.
This method is called for all connection invalidations, including
when the ._ConnectionFairy.invalidate
or
_engine.Connection.invalidate
methods are called,
as well as when any
so-called "automatic invalidation" condition occurs.
See Also
Parameters | |
e | an exception object indicating a reason for the invalidation. |
soft |
New in version 1.0.3.
|
A reference to the actual DBAPI connection being tracked.
May be None if this ._ConnectionRecord
has been marked
as invalidated; a new DBAPI connection may replace it if the owning
pool calls upon this ._ConnectionRecord
to reconnect.
For adapted drivers, like the Asyncio implementations, this is a
.AdaptedConnection
that adapts the driver connection
to the DBAPI protocol.
Use ._ConnectionRecord.driver_connection
to obtain the
connection objected returned by the driver.
An alias to ._ConnectionRecord.dbapi_connection
.
This alias is deprecated, please use the new name.
The connection object as returned by the driver after a connect.
For normal sync drivers that support the DBAPI protocol, this object
is the same as the one referenced by
._ConnectionRecord.dbapi_connection
.
For adapted drivers, like the Asyncio ones, this is the actual object that was returned by the driver connect call.
As ._ConnectionRecord.dbapi_connection
it may be None
if this ._ConnectionRecord
has been marked as invalidated.
The .info dictionary associated with the DBAPI connection.
This dictionary is shared among the ._ConnectionFairy.info
and _engine.Connection.info
accessors.
Note
The lifespan of this dictionary is linked to the
DBAPI connection itself, meaning that it is discarded each time
the DBAPI connection is closed and/or invalidated. The
._ConnectionRecord.record_info
dictionary remains
persistent throughout the lifespan of the
._ConnectionRecord
container.
An "info' dictionary associated with the connection record itself.
Unlike the ._ConnectionRecord.info
dictionary, which is linked
to the lifespan of the DBAPI connection, this dictionary is linked
to the lifespan of the ._ConnectionRecord
container itself
and will remain persistent throughout the life of the
._ConnectionRecord
.