class documentation

class _ConnectionRecord(object):

View In Hierarchy

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.
@classmethod
def checkout(cls, pool):

Undocumented

def __close(self):

Undocumented

def __connect(self):

Undocumented

def __init__(self, pool, connect=True):

Undocumented

def _checkin_failed(self, err, _fairy_was_created=True):

Undocumented

def _is_hard_or_soft_invalidated(self):

Undocumented

def checkin(self, _fairy_was_created=True):

Undocumented

def close(self):

Undocumented

@connection.setter
def connection(self, value):

Undocumented

def get_connection(self):

Undocumented

def invalidate(self, e=None, soft=False):

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.

Parameters
ean 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.
__pool =

Undocumented

_soft_invalidate_time =

Undocumented

dbapi_connection =

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.

New in version 1.4.24.
fairy_ref =

Undocumented

finalize_callback =

Undocumented

fresh: bool =

Undocumented

starttime =

Undocumented

@property
connection =

An alias to ._ConnectionRecord.dbapi_connection.

This alias is deprecated, please use the new name.

Deprecated since version 1.4.24.
@property
driver_connection =

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.

New in version 1.4.24.
@property
in_use =

Undocumented

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.

@property
last_connect_time =

Undocumented

@util.memoized_property
record_info =

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.

New in version 1.1.