관리-도구
편집 파일: dbapi_proxy.cpython-311.pyc
� �܋f� � � � d Z ddlmZ ddlmZ ddlmZ i Z ej dd� � d� � � Zd � Z G d � de � � ZdS ) z�DBAPI proxy utility. Provides transparent connection pooling on top of a Python DBAPI. This is legacy SQLAlchemy functionality that is not typically used today. � )� QueuePool� )�util)� threadingz1.3zYThe :func:`.pool.manage` function is deprecated, and will be removed in a future release.c � � t | S # t $ r) t � | t | fi |��� � cY S w xY w)aH Return a proxy for a DB-API module that automatically pools connections. Given a DB-API 2.0 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connection arguments sent to the decorated module's connect() function. :param module: a DB-API 2.0 database module :param poolclass: the class used by the pool module to provide pooling. Defaults to :class:`.QueuePool`. :param \**params: will be passed through to *poolclass* )�proxies�KeyError� setdefault�_DBProxy)�module�paramss �R/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/pool/dbapi_proxy.py�manager s] � �,F��v����� F� F� F��!�!�&�(�6�*D�*D�V�*D�*D�E�E�E�E�E�F���s � �0A�Ac � � t � � � D ]} | � � � �t � � � dS )zYRemove all current DB-API 2.0 managers. All pools and connections are disposed. N)r �values�close�clear)�managers r �clear_managersr 5 s= � � �>�>�#�#� � ��� � ������M�M�O�O�O�O�O� c �F � e Zd ZdZefd�Zd� Zd� Zd� Zd� Z d� Z d� Zd � Zd S )r a Layers connection pooling behavior on top of a standard DB-API module. Proxies a DB-API 2.0 connect() call to a connection pool keyed to the specific connect parameters. Other functions and attributes are delegated to the underlying DB-API module. c �n � || _ || _ || _ i | _ t j � � | _ dS )z�Initializes a new proxy. module a DB-API 2.0 module poolclass a Pool class, defaulting to QueuePool Other parameters are sent to the Pool object's constructor. N)r �kw� poolclass�poolsr �Lock�_create_pool_mutex)�selfr r r s r �__init__z_DBProxy.__init__I s6 � � ������"����� �"+�.�"2�"2����r c �D � t | j � � D ] }| j |= �d S �N)�listr �r �keys r r z_DBProxy.close\ s0 � ��� �#�#� � �C�� �3��� � r c �. � | � � � d S r! )r )r s r �__del__z_DBProxy.__del__` s � �� � �����r c �, � t | j |� � S r! )�getattrr r# s r �__getattr__z_DBProxy.__getattr__c s � ��t�{�C�(�(�(r c �� � ��� � j �i ���} � j | S # t $ r� � j � � � |� j vrU�� dd � � � j ��� fd�fi � j ��}|� j |<