iddZddlmZddlmZddlmZiZejdddZd Z Gd d e Z d S) zDBAPI 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|cYSwxYw)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* )proxiesKeyError setdefault_DBProxy)moduleparamss P/opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/pool/dbapi_proxy.pymanagers],Fv FFF!!&(6*D*DV*D*DEEEEEFs 0AActD]}|tdS)zYRemove all current DB-API 2.0 managers. All pools and connections are disposed. N)rvaluescloseclear)managers rclear_managersr5s= >>##  MMOOOOOcFeZdZdZefdZdZdZdZdZ dZ dZ d Z d 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)zInitializes 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 poolclasspoolsrLock_create_pool_mutex)selfr rrs r__init__z_DBProxy.__init__Is6 " "+."2"2rcDt|jD] }|j|= dSN)listrrkeys rrz_DBProxy.close\s0 ##  C 3  rc.|dSr!)r)rs r__del__z_DBProxy.__del__`s rc,t|j|Sr!)getattrr r#s r __getattr__z_DBProxy.__getattr__cst{C(((rcji} j|S#t$rj |jvrUddjfdfij}|j|<|jcYSj|jcYS#jwxYwwxYw)N sa_pool_keyc(jjiSr!)r connect)argsrrsrz#_DBProxy.get_pool..ps 3 3T @R @ @r) _serializerr racquirepoprrrelease)rr.rr$pools``` rget_poolz_DBProxy.get_poolfs*dot*r** 2:c? " 2 2 2  # + + - - - 2dj((FF=$///)4>@@@@@@DHGD'+DJsO'//111111 :c?'//111111'//1111 2s. #C(AC C(! C -C( C$$C(c@|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. )r5r-rr.rs rr-z_DBProxy.connectys't}d)b))11333rcT|j|i|} |j|=dS#t$rYdSwxYw)z;Dispose the pool referenced by the given connect arguments.N)r0rr )rr.rr$s rdisposez_DBProxy.disposesNdot*r**  3    DD s  ''cdvrdStt|fdtDzS)Nr+c$g|] }||f Sr<).0krs r z'_DBProxy._serialize..s!"B"B"B!Ar!u:"B"B"Br)tupler"sortedr7s `rr0z_DBProxy._serializesM B  m$ $T$ZZ"B"B"B"Bvbzz"B"B"BBCCCrN) __name__ __module__ __qualname____doc__rrrr&r)r5r-r9r0r<rrr r @s*33333&   )))222&444 DDDDDrr N) rEimplrrrr deprecatedrrobjectr r<rrrJs  # FF  F.VDVDVDVDVDvVDVDVDVDVDr