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 ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Classe « StaticPool »

Constructeur sqlalchemy.StaticPool.__init__

Signature de la constructeur __init__

def __init__(self, creator: 'Union[_CreatorFnType, _CreatorWRecFnType]', recycle: 'int' = -1, echo: 'log._EchoFlagType' = None, logging_name: 'Optional[str]' = None, reset_on_return: '_ResetStyleArgType' = True, events: 'Optional[List[Tuple[_ListenerFnType, str]]]' = None, dialect: 'Optional[Union[_ConnDialect, Dialect]]' = None, pre_ping: 'bool' = False, _dispatch: 'Optional[_DispatchCommon[Pool]]' = None) 

Description

help(StaticPool.__init__)

Construct a Pool.

:param creator: a callable function that returns a DB-API
  connection object.  The function will be called with
  parameters.

:param recycle: If set to a value other than -1, number of
  seconds between connection recycling, which means upon
  checkout, if this timeout is surpassed the connection will be
  closed and replaced with a newly opened connection. Defaults to -1.

:param logging_name:  String identifier which will be used within
  the "name" field of logging records generated within the
  "sqlalchemy.pool" logger. Defaults to a hexstring of the object's
  id.

:param echo: if True, the connection pool will log
 informational output such as when connections are invalidated
 as well as when connections are recycled to the default log handler,
 which defaults to ``sys.stdout`` for output..   If set to the string
 ``"debug"``, the logging will include pool checkouts and checkins.

 The :paramref:`_pool.Pool.echo` parameter can also be set from the
 :func:`_sa.create_engine` call by using the
 :paramref:`_sa.create_engine.echo_pool` parameter.

 .. seealso::

     :ref:`dbengine_logging` - further detail on how to configure
     logging.

:param reset_on_return: Determine steps to take on
 connections as they are returned to the pool, which were
 not otherwise handled by a :class:`_engine.Connection`.
 Available from :func:`_sa.create_engine` via the
 :paramref:`_sa.create_engine.pool_reset_on_return` parameter.

 :paramref:`_pool.Pool.reset_on_return` can have any of these values:

 * ``"rollback"`` - call rollback() on the connection,
   to release locks and transaction resources.
   This is the default value.  The vast majority
   of use cases should leave this value set.
 * ``"commit"`` - call commit() on the connection,
   to release locks and transaction resources.
   A commit here may be desirable for databases that
   cache query plans if a commit is emitted,
   such as Microsoft SQL Server.  However, this
   value is more dangerous than 'rollback' because
   any data changes present on the transaction
   are committed unconditionally.
 * ``None`` - don't do anything on the connection.
   This setting may be appropriate if the database / DBAPI
   works in pure "autocommit" mode at all times, or if
   a custom reset handler is established using the
   :meth:`.PoolEvents.reset` event handler.

 * ``True`` - same as 'rollback', this is here for
   backwards compatibility.
 * ``False`` - same as None, this is here for
   backwards compatibility.

 For further customization of reset on return, the
 :meth:`.PoolEvents.reset` event hook may be used which can perform
 any connection activity desired on reset.

 .. seealso::

    :ref:`pool_reset_on_return`

    :meth:`.PoolEvents.reset`

:param events: a list of 2-tuples, each of the form
 ``(callable, target)`` which will be passed to :func:`.event.listen`
 upon construction.   Provided here so that event listeners
 can be assigned via :func:`_sa.create_engine` before dialect-level
 listeners are applied.

:param dialect: a :class:`.Dialect` that will handle the job
 of calling rollback(), close(), or commit() on DBAPI connections.
 If omitted, a built-in "stub" dialect is used.   Applications that
 make use of :func:`_sa.create_engine` should not use this parameter
 as it is handled by the engine creation strategy.

:param pre_ping: if True, the pool will emit a "ping" (typically
 "SELECT 1", but is dialect-specific) on the connection
 upon checkout, to test if the connection is alive or not.   If not,
 the connection is transparently re-connected and upon success, all
 other pooled connections established prior to that timestamp are
 invalidated.     Requires that a dialect is passed as well to
 interpret the disconnection error.

 .. versionadded:: 1.2



Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé