class documentation

class QueuePool(Pool):

Known subclasses: sqlalchemy.pool.AsyncAdaptedQueuePool

View In Hierarchy

A _pool.Pool that imposes a limit on the number of open connections.

.QueuePool is the default pooling implementation used for all _engine.Engine objects, unless the SQLite dialect is in use.

Method __init__ Construct a QueuePool.
Method ​_dec​_overflow Undocumented
Method ​_do​_get Undocumented
Method ​_do​_return​_conn Undocumented
Method ​_inc​_overflow Undocumented
Method checkedin Undocumented
Method checkedout Undocumented
Method dispose Undocumented
Method overflow Undocumented
Method recreate Undocumented
Method size Undocumented
Method status Undocumented
Method timeout 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
def __init__(self, creator, pool_size=5, max_overflow=10, timeout=30.0, use_lifo=False, **kw):
Construct a QueuePool.
Parameters
creatora callable function that returns a DB-API connection object, same as that of :paramref:`_pool.Pool.creator`.
pool​_sizeThe 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 ~sqlalchemy.pool.NullPool instead.
max​_overflowThe 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.
timeoutThe 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.
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.

New in version 1.3.
**kwOther keyword arguments including :paramref:`_pool.Pool.recycle`, :paramref:`_pool.Pool.echo`, :paramref:`_pool.Pool.reset_on_return` and others are passed to the _pool.Pool constructor.
def _dec_overflow(self):

Undocumented

def _do_get(self):

Undocumented

def _do_return_conn(self, conn):

Undocumented

def _inc_overflow(self):

Undocumented

def checkedin(self):

Undocumented

def checkedout(self):

Undocumented

def dispose(self):

Undocumented

def overflow(self):

Undocumented

def recreate(self):

Undocumented

def size(self):

Undocumented

def status(self):

Undocumented

def timeout(self):

Undocumented

_is_asyncio: bool =

Undocumented

_max_overflow =

Undocumented

_overflow =

Undocumented

_overflow_lock =

Undocumented

_pool =

Undocumented

_timeout =

Undocumented