Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « sqlalchemy »

Classe « SingletonThreadPool »

Informations générales

Héritage

builtins.object
    EventTarget
builtins.object
    Identified
        Pool
            SingletonThreadPool

Définition

class SingletonThreadPool(Pool):

help(SingletonThreadPool)

A Pool that maintains one connection per thread.

Maintains one connection per each thread, never moving a connection to a
thread other than the one which it was created in.

.. warning::  the :class:`.SingletonThreadPool` will call ``.close()``
   on arbitrary connections that exist beyond the size setting of
   ``pool_size``, e.g. if more unique **thread identities**
   than what ``pool_size`` states are used.   This cleanup is
   non-deterministic and not sensitive to whether or not the connections
   linked to those thread identities are currently in use.

   :class:`.SingletonThreadPool` may be improved in a future release,
   however in its current status it is generally used only for test
   scenarios using a SQLite ``:memory:`` database and is not recommended
   for production use.

The :class:`.SingletonThreadPool` class **is not compatible** with asyncio
and :func:`_asyncio.create_async_engine`.


Options are the same as those of :class:`_pool.Pool`, as well as:

:param pool_size: The number of threads in which to maintain connections
    at once.  Defaults to five.

:class:`.SingletonThreadPool` is used by the SQLite dialect
automatically when a memory-based database is used.
See :ref:`sqlite_toplevel`.

Constructeur(s)

Signature du constructeur Description
__init__(self, creator: 'Union[_CreatorFnType, _CreatorWRecFnType]', pool_size: 'int' = 5, **kw: 'Any')

Liste des attributs statiques

Nom de l'attribut Valeur
dispatch<sqlalchemy.event.base.PoolEventsDispatch object at 0x0000020D9F45D3B0>
logging_nameNone

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
connect(self) -> 'PoolProxiedConnection'
dispose(self) -> 'None' Dispose of this pool. [extrait de dispose.__doc__]
recreate(self) -> 'SingletonThreadPool'
status(self) -> 'str'

Méthodes héritées de la classe Pool

__init_subclass__, __subclasshook__

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé