Server IP : 192.158.238.246 / Your IP : 18.216.156.171 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/pool/__pycache__/ |
Upload File : |
B ��4]�� � @ s� d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd l mZ e �d�Z e �d�Ze �d �ZG dd� de�ZG dd� de j�ZG dd� de�Zddd�Ze� ZG dd� de�ZdS )z'Base constructs for connection pools. � )�dequeN� )�event)�exc)� interfaces)�log)�util)� threading�reset_rollback�reset_commit� reset_nonec @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd S )�_ConnDialectz�partial implementation of :class:`.Dialect` which provides DBAPI connection methods. When a :class:`.Pool` is combined with an :class:`.Engine`, the :class:`.Engine` replaces this with its own :class:`.Dialect`. c C s |� � d S )N)�rollback)�self�dbapi_connection� r �G/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/pool/base.py�do_rollback) s z_ConnDialect.do_rollbackc C s |� � d S )N)�commit)r r r r r � do_commit, s z_ConnDialect.do_commitc C s |� � d S )N)�close)r r r r r �do_close/ s z_ConnDialect.do_closec C s t d��d S )NzJThe ping feature requires that a dialect is passed to the connection pool.)�NotImplementedError)r r r r r �do_ping2 s z_ConnDialect.do_pingN)�__name__� __module__�__qualname__�__doc__r r r r r r r r r s r c @ s� e Zd ZdZe� Zejddd�d*d d ��Ze dd� �Z e jd d� �Z dd� Zdd� Z e�dd�dd� �Zdd� Zdd� Zd+dd�Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� ZdS ),�Poolz)Abstract base class for connection pools.)z1.3zfThe :paramref:`.Pool.use_threadlocal` parameter is deprecated and will be removed in a future release.)z0.7z�:class:`.PoolListener` is deprecated in favor of the :class:`.PoolEvents` listener interface. The :paramref:`.Pool.listeners` parameter will be removed in a future release.)�use_threadlocal� listeners���NFTc C s |r| | _ | _nd| _tj| |d� t�� | _|| _|| _d| _ || _ | | _|ddtfkrdt| _ n:|dddtfkr|t| _ n"|dtfkr�t| _ nt�d | ��|| _|r�| jj|dd � | r�| | _|r�x|D ]\}} t�| | |� q�W |�rx|D ]}| �|� q�W dS )a 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.echo` parameter can also be set from the :func:`.create_engine` call by using the :paramref:`.create_engine.echo_pool` parameter. .. seealso:: :ref:`dbengine_logging` - further detail on how to configure logging. :param use_threadlocal: If set to True, repeated calls to :meth:`connect` within the same application thread will be guaranteed to return the same connection object that is already checked out. This is a legacy use case and the flag has no effect when using the pool with a :class:`.Engine` object. :param reset_on_return: Determine steps to take on connections as they are returned to the 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. * ``True`` - same as 'rollback', this is here for backwards compatibility. * ``"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 should generally only be made on a database that has no transaction support at all, namely MySQL MyISAM; when used on this backend, performance can be improved as the "rollback" call is still expensive on MySQL. It is **strongly recommended** that this setting not be used for transaction-supporting databases in conjunction with a persistent pool such as :class:`.QueuePool`, as it opens the possibility for connections still in a transaction to be idle in the pool. The setting may be appropriate in the case of :class:`.NullPool` or special circumstances where the connection pool in use is not being used to maintain connection lifecycle. * ``False`` - same as None, this is here for backwards compatibility. :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:`.create_engine` before dialect-level listeners are applied. :param listeners: A list of :class:`.PoolListener`-like objects or dictionaries of callables that receive events when DB-API connections are created, checked out and checked in to the pool. :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:`~.create_engine` should not use this parameter as it is handled by the engine creation strategy. .. versionadded:: 1.1 - ``dialect`` is now a public parameter to the :class:`.Pool`. :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 N)Zechoflagr r TZnoneFr z'Invalid value for 'reset_on_return': %r)Zonly_propagate)�logging_nameZ_orig_logging_namer Zinstance_loggerr �local�_threadconns�_creator�_recycle�_invalidate_time�_use_threadlocal� _pre_pingr �_reset_on_returnr r r � ArgumentError�echo�dispatchZ_update�_dialectr �listen�add_listener)r �creator�recycler, r r"