U a@s\dZddlmZddlmZddlmZiZedddd Zd d Z Gd d d e Z dS)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 Ks8z t|WStk r2t|t|f|YSXdS)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* N)proxiesKeyError setdefault_DBProxy)moduleparamsr \C:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\pool\dbapi_proxy.pymanages rcCs"tD] }|qtdS)zYRemove all current DB-API 2.0 managers. All pools and connections are disposed. N)rvaluescloseclear)managerr r r clear_managers5s  rc@sTeZdZdZefddZddZddZdd Zd d Z d d Z ddZ ddZ 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)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 rrr r r __init__Is z_DBProxy.__init__cCst|jD] }|j|=q dSN)listrrkeyr r r r\sz_DBProxy.closecCs |dSr)r)rr r r __del__`sz_DBProxy.__del__cCs t|j|Sr)getattrr rr r r __getattr__csz_DBProxy.__getattr__c sj}z j|WStk rjp|jkrddjfddfj}|j|<|W5QRYSj|W5QRYSW5QRXYnXdS)N sa_pool_keycsjjSr)r connectr argsrrr r oz#_DBProxy.get_pool..) _serializerrrpoprr)rr%rrpoolr r$r get_poolfs     z_DBProxy.get_poolcOs|j||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#vsz_DBProxy.connectcOs2|j||}z |j|=Wntk r,YnXdS)z;Dispose the pool referenced by the given connect arguments.N)r(rr)rr%rrr r r disposes   z_DBProxy.disposecs2dkrdStt|fddtDS)Nr"csg|]}||fqSr r ).0krr r sz'_DBProxy._serialize..)tuplersortedr,r r0r r(sz_DBProxy._serializeN) __name__ __module__ __qualname____doc__rrrrr!r+r#r-r(r r r r r @s  r N) r7implrrrr deprecatedrrobjectr r r r r  s