class documentation

A :class:`_pool.Pool` that imposes a limit on the number of open connections. :class:`.QueuePool` is the default pooling implementation used for all :class:`_engine.Engine` objects, unless the SQLite dialect is in use.

Method __init__ Construct a QueuePool.
Method checkedin Undocumented
Method checkedout Undocumented
Method dispose Dispose of this pool.
Method overflow Undocumented
Method recreate Return a new :class:`_pool.Pool`, of the same class as this one and configured with identical creation arguments.
Method size Undocumented
Method status Undocumented
Method timeout Undocumented
Method _dec_overflow Undocumented
Method _do_get Implementation for :meth:`get`, supplied by subclasses.
Method _do_return_conn Implementation for :meth:`return_conn`, supplied by subclasses.
Method _inc_overflow Undocumented
Class Variable _is_asyncio Undocumented
Instance Variable _max_overflow Undocumented
Instance Variable _overflow Undocumented
Instance Variable _overflow_lock Undocumented
Instance Variable _pool Undocumented
Instance Variable _timeout Undocumented

Inherited from Pool:

Method connect Return a DBAPI connection from the pool.
Class Variable dispatch Undocumented
Instance Variable echo Undocumented
Instance Variable logging_name Undocumented
Method _close_connection Undocumented
Method _create_connection Called by subclasses to create a new ConnectionRecord.
Method _creator.deleter Undocumented
Method _creator.setter Undocumented
Method _invalidate Mark all connections established within the generation of the given connection as invalidated.
Method _return_conn Given a _ConnectionRecord, return it to the :class:`_pool.Pool`.
Method _should_wrap_creator Detect if creator accepts a single argument, or is sent as a legacy style no-arg function.
Instance Variable _creator_arg Undocumented
Instance Variable _dialect Undocumented
Instance Variable _invalidate_time Undocumented
Instance Variable _invoke_creator Undocumented
Instance Variable _orig_logging_name Undocumented
Instance Variable _pre_ping Undocumented
Instance Variable _recycle Undocumented
Instance Variable _reset_on_return Undocumented
Property _creator Undocumented

Inherited from Identified (via Pool):

Class Variable __slots__ Undocumented
Class Variable logger Undocumented
Method _should_log_debug Undocumented
Method _should_log_info Undocumented
Class Variable _echo Undocumented
def __init__(self, creator: Union[_CreatorFnType, _CreatorWRecFnType], pool_size: int = 5, max_overflow: int = 10, timeout: float = 30.0, use_lifo: bool = False, **kw: Any): (source)

Construct a QueuePool. :param creator: a callable function that returns a DB-API connection object, same as that of :paramref:`_pool.Pool.creator`. :param pool_size: The size of the pool to be maintained, defaults to 5. This is the largest number of connections that will be kept persistently in the pool. Note that the pool begins with no connections; once this number of connections is requested, that number of connections will remain. ``pool_size`` can be set to 0 to indicate no size limit; to disable pooling, use a :class:`~sqlalchemy.pool.NullPool` instead. :param max_overflow: The maximum overflow size of the pool. When the number of checked-out connections reaches the size set in pool_size, additional connections will be returned up to this limit. When those additional connections are returned to the pool, they are disconnected and discarded. It follows then that the total number of simultaneous connections the pool will allow is pool_size + `max_overflow`, and the total number of "sleeping" connections the pool will allow is pool_size. `max_overflow` can be set to -1 to indicate no overflow limit; no limit will be placed on the total number of concurrent connections. Defaults to 10. :param timeout: The number of seconds to wait before giving up on returning a connection. Defaults to 30.0. This can be a float but is subject to the limitations of Python time functions which may not be reliable in the tens of milliseconds. :param use_lifo: use LIFO (last-in-first-out) when retrieving connections instead of FIFO (first-in-first-out). Using LIFO, a server-side timeout scheme can reduce the number of connections used during non-peak periods of use. When planning for server-side timeouts, ensure that a recycle or pre-ping strategy is in use to gracefully handle stale connections. .. versionadded:: 1.3 .. seealso:: :ref:`pool_use_lifo` :ref:`pool_disconnects` :param \**kw: Other keyword arguments including :paramref:`_pool.Pool.recycle`, :paramref:`_pool.Pool.echo`, :paramref:`_pool.Pool.reset_on_return` and others are passed to the :class:`_pool.Pool` constructor.

def checkedin(self) -> int: (source)

Undocumented

def checkedout(self) -> int: (source)

Undocumented

def dispose(self): (source)

Dispose of this pool. This method leaves the possibility of checked-out connections remaining open, as it only affects connections that are idle in the pool. .. seealso:: :meth:`Pool.recreate`

def overflow(self) -> int: (source)

Undocumented

def recreate(self) -> QueuePool: (source)

Return a new :class:`_pool.Pool`, of the same class as this one and configured with identical creation arguments. This method is used in conjunction with :meth:`dispose` to close out an entire :class:`_pool.Pool` and create a new one in its place.

def size(self) -> int: (source)

Undocumented

def status(self) -> str: (source)

Undocumented

def timeout(self) -> float: (source)

Undocumented

def _dec_overflow(self) -> Literal[True]: (source)

Undocumented

def _do_get(self) -> ConnectionPoolEntry: (source)

Implementation for :meth:`get`, supplied by subclasses.

def _do_return_conn(self, record: ConnectionPoolEntry): (source)

Implementation for :meth:`return_conn`, supplied by subclasses.

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

Undocumented

_max_overflow = (source)

Undocumented

_overflow = (source)

Undocumented

_overflow_lock = (source)

Undocumented

Undocumented

_timeout = (source)

Undocumented