/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool
Edit: /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyc (5756B)
σ
ΓΜ4]c @ sz d Z d d l m Z d d l m Z d d l m Z i Z e j d d d Z d Z d
e
f d YZ d S(
s€ DBAPI proxy utility.
Provides transparent connection pooling on top of a Python DBAPI.
This is legacy SQLAlchemy functionality that is not typically used
today.
i ( t QueuePooli ( t util( t threadings 1.3sY The :func:`.pool.manage` function is deprecated, and will be removed in a future release.c K s: y t | SWn' t k
r5 t j | t | | SXd S( sH 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*
N( t proxiest KeyErrort
setdefaultt _DBProxy( t modulet params( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt manage s
c C s/ x t j D] } | j q
Wt j d S( sY Remove all current DB-API 2.0 managers.
All pools and connections are disposed.
N( R t valuest closet clear( t manager( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt clear_managers5 s R c B sY e Z d Z e d Z d Z d Z d Z d Z d Z d Z
d Z RS( s 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 K s7 | | _ | | _ | | _ i | _ t j | _ d S( sΨ 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 t kwt poolclasst poolsR t Lockt _create_pool_mutex( t selfR R R ( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt __init__I s
c C s( x! t | j D] } | j | =q Wd S( N( t listR ( R t key( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyR \ s c C s | j d S( N( R ( R ( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt __del__` s c C s t | j | S( N( t getattrR ( R R ( ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt __getattr__c s c sΊ j } y j | SWn t k
r΅ j j zc | j k r j d d j f d j } | j | <| S j | SWd j j Xn Xd S( Nt sa_pool_keyc s j j S( N( R t connect( ( t argsR R ( sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt
p t (
t
_serializeR R R t acquiret popt NoneR R t release( R R R R t pool( ( R R R sN /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/pool/dbapi_proxy.pyt get_poolf s
c O s | j | | j S( s, 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&