class documentation

class _ConnectionRecord(ConnectionPoolEntry): (source)

View In Hierarchy

Maintains a position in a connection pool which references a pooled connection. This is an internal object used by the :class:`_pool.Pool` implementation to provide context management to a DBAPI connection maintained by that :class:`_pool.Pool`. The public facing interface for this class is described by the :class:`.ConnectionPoolEntry` class. See that class for public API details. .. seealso:: :class:`.ConnectionPoolEntry` :class:`.PoolProxiedConnection`

Class Method checkout Undocumented
Method __init__ Undocumented
Method checkin Undocumented
Method close Close the DBAPI connection managed by this connection pool entry.
Method get_connection Undocumented
Method invalidate Mark the managed connection as invalidated.
Class Variable __slots__ 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 Undocumented
Property driver_connection The "driver level" connection object as used by the Python DBAPI or database driver.
Property in_use Return True the connection is currently checked out
Property info Info dictionary associated with the underlying DBAPI connection referred to by this :class:`.ManagesConnection` instance, allowing user-defined data to be associated with the connection.
Property last_connect_time Undocumented
Property record_info Persistent info dictionary associated with this :class:`.ManagesConnection`.
Method __close Undocumented
Method __connect Undocumented
Method _checkin_failed Undocumented
Method _is_hard_or_soft_invalidated Undocumented
Instance Variable __pool Undocumented
Instance Variable _soft_invalidate_time Undocumented
@classmethod
def checkout(cls, pool: Pool) -> _ConnectionFairy: (source)

Undocumented

def __init__(self, pool: Pool, connect: bool = True): (source)

Undocumented

def checkin(self, _fairy_was_created: bool = True): (source)

Undocumented

def close(self): (source)

Close the DBAPI connection managed by this connection pool entry.

def get_connection(self) -> DBAPIConnection: (source)

Undocumented

def invalidate(self, e: Optional[BaseException] = None, soft: bool = False): (source)

Mark the managed connection as invalidated. :param e: an exception object indicating a reason for the invalidation. :param soft: if True, the connection isn't closed; instead, this connection will be recycled on next checkout. .. seealso:: :ref:`pool_connection_invalidation`

dbapi_connection = (source)

A reference to the actual DBAPI connection being tracked. This is a :pep:`249`-compliant object that for traditional sync-style dialects is provided by the third-party DBAPI implementation in use. For asyncio dialects, the implementation is typically an adapter object provided by the SQLAlchemy dialect itself; the underlying asyncio object is available via the :attr:`.ManagesConnection.driver_connection` attribute. SQLAlchemy's interface for the DBAPI connection is based on the :class:`.DBAPIConnection` protocol object .. seealso:: :attr:`.ManagesConnection.driver_connection` :ref:`faq_dbapi_connection`

fairy_ref = (source)

Undocumented

finalize_callback = (source)

Undocumented

Undocumented

starttime = (source)

Undocumented

@property
@util.deprecated('2.0', 'The _ConnectionRecord.connection attribute is deprecated; please use \'driver_connection\'')
connection: Optional[DBAPIConnection] = (source)

Undocumented

@property
driver_connection: Optional[Any] = (source)

The "driver level" connection object as used by the Python DBAPI or database driver. For traditional :pep:`249` DBAPI implementations, this object will be the same object as that of :attr:`.ManagesConnection.dbapi_connection`. For an asyncio database driver, this will be the ultimate "connection" object used by that driver, such as the ``asyncpg.Connection`` object which will not have standard pep-249 methods. .. versionadded:: 1.4.24 .. seealso:: :attr:`.ManagesConnection.dbapi_connection` :ref:`faq_dbapi_connection`

Return True the connection is currently checked out

@util.ro_memoized_property
info: _InfoType = (source)

Info dictionary associated with the underlying DBAPI connection referred to by this :class:`.ManagesConnection` instance, allowing user-defined data to be associated with the connection. The data in this dictionary is persistent for the lifespan of the DBAPI connection itself, including across pool checkins and checkouts. When the connection is invalidated and replaced with a new one, this dictionary is cleared. For a :class:`.PoolProxiedConnection` instance that's not associated with a :class:`.ConnectionPoolEntry`, such as if it were detached, the attribute returns a dictionary that is local to that :class:`.ConnectionPoolEntry`. Therefore the :attr:`.ManagesConnection.info` attribute will always provide a Python dictionary. .. seealso:: :attr:`.ManagesConnection.record_info`

@property
last_connect_time: float = (source)

Undocumented

@util.ro_memoized_property
record_info: Optional[_InfoType] = (source)

Persistent info dictionary associated with this :class:`.ManagesConnection`. Unlike the :attr:`.ManagesConnection.info` dictionary, the lifespan of this dictionary is that of the :class:`.ConnectionPoolEntry` which owns it; therefore this dictionary will persist across reconnects and connection invalidation for a particular entry in the connection pool. For a :class:`.PoolProxiedConnection` instance that's not associated with a :class:`.ConnectionPoolEntry`, such as if it were detached, the attribute returns None. Contrast to the :attr:`.ManagesConnection.info` dictionary which is never None. .. seealso:: :attr:`.ManagesConnection.info`

def __close(self, *, terminate: bool = False): (source)

Undocumented

def __connect(self): (source)

Undocumented

def _checkin_failed(self, err: BaseException, _fairy_was_created: bool = True): (source)

Undocumented

def _is_hard_or_soft_invalidated(self) -> bool: (source)

Undocumented

Undocumented

_soft_invalidate_time = (source)

Undocumented