o z¾nhàã@s\dZddlmZddlmZddlmZiZe dd¡dd „ƒZd d „Z Gd d „d e ƒZ dS)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 Ks6zt|WStyt |t|fi|¤Ž¡YSw)aHReturn 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Úparams©r úF/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/dbapi_proxy.pyÚmanages   ÿrcCs"t ¡D]}| ¡qt ¡dS)zYRemove all current DB-API 2.0 managers. All pools and connections are disposed. N)rÚvaluesÚcloseÚclear)Úmanagerr r r Úclear_managers5s   rc@sTeZdZdZefdd„Zdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dd„Z dS)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. cKs&||_||_||_i|_t ¡|_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 rrr r r Ú__init__Is  z_DBProxy.__init__cCst|jƒD]}|j|=qdS©N)Úlistr©rÚkeyr r r r\s ÿz_DBProxy.closecCs | ¡dSr)r)rr r r Ú__del__`ó z_DBProxy.__del__cCs t|j|ƒSr)Úgetattrr rr r r Ú __getattr__cr z_DBProxy.__getattr__c s²ˆjˆiˆ¤Ž}zˆj|WStyXˆj ¡z7|ˆjvrEˆ dd¡ˆj‡‡‡fdd„fiˆj¤Ž}|ˆj|<|Wˆj ¡YSˆj|Wˆj ¡YSˆj ¡ww)NÚ sa_pool_keycsˆjjˆiˆ¤ŽSr)r Úconnectr ©Úargsrrr r Úpsz#_DBProxy.get_pool..) Ú _serializerrrÚacquireÚpoprrÚrelease)rr&rrÚpoolr r%r Úget_poolfs&     ÿÿ  þóz_DBProxy.get_poolcOs|j|i|¤Ž ¡S)a,Activate a connection to the database. Connect to the database using this DBProxy's module and the given connect arguments. If the arguments match an existing pool, the connection will be returned from the pool's current thread-local connection instance, or if there is no thread-local connection instance it will be checked out from the set of pooled connections. If the pool has no available connections and allows new connections to be created, a new database connection will be made. )r-r$©rr&rr r r r$ysz_DBProxy.connectcOs4|j|i|¤Ž}z|j|=WdStyYdSw)z;Dispose the pool referenced by the given connect arguments.N)r(rr)rr&rrr r r Údispose‰s  ÿz_DBProxy.disposecs2dˆvrˆdStt|ƒ‡fdd„tˆƒDƒƒS)Nr#csg|]}|ˆ|f‘qSr r )Ú.0Úk©rr r Ú –sz'_DBProxy._serialize..)ÚtuplerÚsortedr.r r2r r(’s"z_DBProxy._serializeN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrrr"r-r$r/r(r r r r r @s  r N) r9ÚimplrÚrrrÚ deprecatedrrÚobjectr r r r r Ús  þ