Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
‹EYc@sËdZddlZddlZddlZddlmZmZmZmZm	Z	ddl	m
Zddl	mZm
Z
mZddlmZiZd„Zd	„Ze	jd
ƒZe	jdƒZe	jdƒZd
efd„ƒYZdejfd„ƒYZdefd„ƒYZed„ZeƒZ defd„ƒYZ!defd„ƒYZ"defd„ƒYZ#defd„ƒYZ$defd„ƒYZ%defd„ƒYZ&d efd!„ƒYZ'dS("s{Connection pooling for DB-API connections.

Provides a number of connection pool implementations for a variety of
usage scenarios and thread behavior requirements imposed by the
application, DB-API or database itself.

Also provides a DB-API 2.0 connection proxying mechanism allowing
regular DB-API connect() methods to be transparently managed by a
SQLAlchemy connection pool.
iÿÿÿÿNi(texctlogteventt
interfacestutil(tqueue(t	threadingtmemoized_propertytchop_traceback(tdequecKs:yt|SWn'tk
r5tj|t||ƒSXdS(sHReturn 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(tproxiestKeyErrort
setdefaultt_DBProxy(tmoduletparams((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytmanage!s
cCs/xtjƒD]}|jƒq
WtjƒdS(sYRemove all current DB-API 2.0 managers.

    All pools and connections are disposed.
    N(R
tvaluestclosetclear(tmanager((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytclear_managers8streset_rollbacktreset_committ
reset_nonet_ConnDialectcBs)eZdZd„Zd„Zd„ZRS(sêpartial implementation of :class:`.Dialect`
    which provides DBAPI connection methods.

    When a :class:`.Pool` is combined with an :class:`.Engine`,
    the :class:`.Engine` replaces this with its own
    :class:`.Dialect`.

    cCs|jƒdS(N(trollback(tselftdbapi_connection((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytdo_rollbackRscCs|jƒdS(N(tcommit(RR((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt	do_commitUscCs|jƒdS(N(R(RR((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytdo_closeXs(t__name__t
__module__t__doc__RRR (((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRGs			tPoolc
BsæeZdZeƒZddededdddd„	Ze	d„ƒZ
e
jd„ƒZ
d„Zd„Z
ejddƒd	„ƒZd
„Zd„Zdd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s)Abstract base class for connection pools.iÿÿÿÿcCsƒ|r||_|_n	d	|_tj|d|ƒtjƒ|_||_||_	d|_
||_|dtt
fkr‰t
|_nU|dd	ttfkr­t|_n1|dtfkrËt|_ntjd|ƒ‚||_|	r|jj|	dtƒn|
r|
|_n|rKx*|D]\}}tj|||ƒq%Wn|rtjdƒx|D]}
|j|
ƒqeWnd	S(
sÌ
        Construct a Pool.

        :param creator: a callable function that returns a DB-API
          connection object.  The function will be called with
          parameters.

        :param recycle: If set to non -1, number of seconds between
          connection recycling, which means upon checkout, if this
          timeout is surpassed the connection will be closed and
          replaced with a newly opened connection. Defaults to -1.

        :param logging_name:  String identifier which will be used within
          the "name" field of logging records generated within the
          "sqlalchemy.pool" logger. Defaults to a hexstring of the object's
          id.

        :param echo: If True, connections being pulled and retrieved
          from the pool will be logged to the standard output, as well
          as pool sizing information.  Echoing can also be achieved by
          enabling logging for the "sqlalchemy.pool"
          namespace. Defaults to False.

        :param use_threadlocal: If set to True, repeated calls to
          :meth:`connect` within the same application thread will be
          guaranteed to return the same connection object, if one has
          already been retrieved from the pool and has not been
          returned yet.  Offers a slight performance advantage at the
          cost of individual transactions by default.  The
          :meth:`.Pool.unique_connection` method is provided to return
          a consistenty unique connection to bypass this behavior
          when the flag is set.

          .. warning::  The :paramref:`.Pool.use_threadlocal` flag
             **does not affect the behavior** of :meth:`.Engine.connect`.
             :meth:`.Engine.connect` makes use of the
             :meth:`.Pool.unique_connection` method which **does not use thread
             local context**.  To produce a :class:`.Connection` which refers
             to the :meth:`.Pool.connect` method, use
             :meth:`.Engine.contextual_connect`.

             Note that other SQLAlchemy connectivity systems such as
             :meth:`.Engine.execute` as well as the orm
             :class:`.Session` make use of
             :meth:`.Engine.contextual_connect` internally, so these functions
             are compatible with the :paramref:`.Pool.use_threadlocal` setting.

          .. seealso::

            :ref:`threadlocal_strategy` - contains detail on the
            "threadlocal" engine strategy, which provides a more comprehensive
            approach to "threadlocal" connectivity for the specific
            use case of using :class:`.Engine` and :class:`.Connection` objects
            directly.

        :param reset_on_return: Determine steps to take on
          connections as they are returned to the pool.
          reset_on_return can have any of these values:

          * ``"rollback"`` - call rollback() on the connection,
            to release locks and transaction resources.
            This is the default value.  The vast majority
            of use cases should leave this value set.
          * ``True`` - same as 'rollback', this is here for
            backwards compatibility.
          * ``"commit"`` - call commit() on the connection,
            to release locks and transaction resources.
            A commit here may be desirable for databases that
            cache query plans if a commit is emitted,
            such as Microsoft SQL Server.  However, this
            value is more dangerous than 'rollback' because
            any data changes present on the transaction
            are committed unconditionally.
          * ``None`` - don't do anything on the connection.
            This setting should only be made on a database
            that has no transaction support at all,
            namely MySQL MyISAM.   By not doing anything,
            performance can be improved.   This
            setting should **never be selected** for a
            database that supports transactions,
            as it will lead to deadlocks and stale
            state.
          * ``"none"`` - same as ``None``

            .. versionadded:: 0.9.10

          * ``False`` - same as None, this is here for
            backwards compatibility.

          .. versionchanged:: 0.7.6
              :paramref:`.Pool.reset_on_return` accepts ``"rollback"``
              and ``"commit"`` arguments.

        :param events: a list of 2-tuples, each of the form
         ``(callable, target)`` which will be passed to :func:`.event.listen`
         upon construction.   Provided here so that event listeners
         can be assigned via :func:`.create_engine` before dialect-level
         listeners are applied.

        :param listeners: Deprecated.  A list of
          :class:`~sqlalchemy.interfaces.PoolListener`-like objects or
          dictionaries of callables that receive events when DB-API
          connections are created, checked out and checked in to the
          pool.  This has been superseded by
          :func:`~sqlalchemy.event.listen`.

        techoflagiRtnoneRs'Invalid value for 'reset_on_return': %rtonly_propagatesZThe 'listeners' argument to Pool (and create_engine()) is deprecated.  Use event.listen().N(tlogging_namet_orig_logging_nametNoneRtinstance_loggerRtlocalt_threadconnst_creatort_recyclet_invalidate_timet_use_threadlocaltTrueRt_reset_on_returntFalseRRRt
ArgumentErrortechotdispatcht_updatet_dialectRtlistenRtwarn_deprecatedtadd_listener(RtcreatortrecycleR6tuse_threadlocalR(treset_on_returnt	listenersteventst	_dispatchR9tfnttargettl((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt__init__bs>t					
	
cCs|jdS(NR.(t__dict__(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR.üscCs#||jd<|j|ƒ|_dS(NR.(RHt_should_wrap_creatort_invoke_creator(RR=((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR.s
cs¼ytj|jdtƒ}Wntk
r9‡fd†SX|ddk	rZt|dƒp]d}t|dƒ|}|d|dfdgd	fkr›ˆS|dkr«ˆS‡fd†SdS(
slDetect if creator accepts a single argument, or is sent
        as a legacy style no-arg function.

        tno_selfcsˆƒS(N((tcrec(R=(sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt<lambda>siitconnection_recordicsˆƒS(N((RL(R=(sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRMsN(N(Rtget_callable_argspecR.R2t	TypeErrorR*tlen(RR=targspect	defaultedtpositionals((R=sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRIs
&#cCsX|jjd|ƒy|jj|ƒWn*tk
rS|jjd|dtƒnXdS(NsClosing connection %rsException closing connection %rtexc_info(tloggertdebugR9R t	ExceptionterrorR2(Rt
connection((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_close_connections
gš™™™™™@s4Pool.add_listener is deprecated.  Use event.listen()cCstjj||ƒdS(sAdd a :class:`.PoolListener`-like object to this pool.

        ``listener`` may be an object that implements some or all of
        PoolListener, or a dictionary of callables containing implementations
        of some or all of the named methods in PoolListener.

        N(RtPoolListenert_adapt_listener(Rtlistener((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR<'s
cCs
tj|ƒS(s’Produce a DBAPI connection that is not referenced by any
        thread-local context.

        This method is equivalent to :meth:`.Pool.connect` when the
        :paramref:`.Pool.use_threadlocal` flag is not set to True.
        When :paramref:`.Pool.use_threadlocal` is True, the
        :meth:`.Pool.unique_connection` method provides a means of bypassing
        the threadlocal context.

        (t_ConnectionFairyt	_checkout(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytunique_connection3scCs
t|ƒS(s6Called by subclasses to create a new ConnectionRecord.(t_ConnectionRecord(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_create_connection@scCsct|ddƒ}|s+|j|jkr=tjƒ|_nt|dtƒr_|j|ƒndS(sšMark all connections established within the generation
        of the given connection as invalidated.

        If this pool's last invalidate time is before when the given
        connection was created, update the timestamp til now.  Otherwise,
        no action is performed.

        Connections with a start time prior to this pool's invalidation
        time will be recycled upon next checkout.
        t_connection_recordtis_validN(tgetattrR*R0t	starttimettimeR4t
invalidate(RRZt	exceptiontrec((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_invalidateEs
cCs
tƒ‚dS(sReturn a new :class:`.Pool`, of the same class as this one
        and configured with identical creation arguments.

        This method is used in conjunction with :meth:`dispose`
        to close out an entire :class:`.Pool` and create a new one in
        its place.

        N(tNotImplementedError(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytrecreateVs
cCs
tƒ‚dS(sôDispose of this pool.

        This method leaves the possibility of checked-out connections
        remaining open, as it only affects connections that are
        idle in the pool.

        See also the :meth:`Pool.recreate` method.

        N(Rm(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytdisposebscCsf|jstj|ƒSy|jjƒ}Wntk
r<nX|dk	rS|jƒStj||jƒS(sÈReturn a DBAPI connection from the pool.

        The connection is instrumented such that when its
        ``close()`` method is called, the connection will be returned to
        the pool.

        N(R1R_R`R-tcurrenttAttributeErrorR*t_checkout_existing(RRk((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytconnectos	


cCs>|jr-y
|j`Wq-tk
r)q-Xn|j|ƒdS(sµGiven a _ConnectionRecord, return it to the :class:`.Pool`.

        This method is called when an instrumented DBAPI connection
        has its ``close()`` method called.

        N(R1R-RpRqt_do_return_conn(Rtrecord((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_return_conn„s	

cCs
tƒ‚dS(s7Implementation for :meth:`get`, supplied by subclasses.N(Rm(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_do_get’scCs
tƒ‚dS(s?Implementation for :meth:`return_conn`, supplied by subclasses.N(Rm(Rtconn((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRt—scCs
tƒ‚dS(N(Rm(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytstatusœsN(R!R"R#RR9R*R4R2RGtpropertyR.tsetterRIR[Rt
deprecatedR<RaRcRlRnRoRsRvRwRtRy(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR$\s4	’			
			
				RbcBs€eZdZd„ZdZdZejd„ƒZ	e
d„ƒZd„Zd„Z
ded„Zd„Zd	„Zd
„ZRS(s¡Internal object which maintains an individual DBAPI connection
    referenced by a :class:`.Pool`.

    The :class:`._ConnectionRecord` object always exists for any particular
    DBAPI connection whether or not that DBAPI connection has been
    "checked out".  This is in contrast to the :class:`._ConnectionFairy`
    which is only a public facade to the DBAPI connection while it is checked
    out.

    A :class:`._ConnectionRecord` may exist for a span longer than that
    of a single DBAPI connection.  For example, if the
    :meth:`._ConnectionRecord.invalidate`
    method is called, the DBAPI connection associated with this
    :class:`._ConnectionRecord`
    will be discarded, but the :class:`._ConnectionRecord` may be used again,
    in which case a new DBAPI connection is produced when the :class:`.Pool`
    next uses this record.

    The :class:`._ConnectionRecord` is delivered along with connection
    pool events, including :meth:`.PoolEvents.connect` and
    :meth:`.PoolEvents.checkout`, however :class:`._ConnectionRecord` still
    remains an internal object whose API and internals may change.

    .. seealso::

        :class:`._ConnectionFairy`

    cCsc||_|jƒ|_tƒ|_|jjj|jƒj|j|ƒ|jj	|j|ƒdS(N(
t_ConnectionRecord__poolt_ConnectionRecord__connectRZR	tfinalize_callbackR7t
first_connectt
for_modifyt	exec_onceRs(Rtpool((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRG¿s	
icCsiS(sÄThe ``.info`` dictionary associated with the DBAPI connection.

        This dictionary is shared among the :attr:`._ConnectionFairy.info`
        and :attr:`.Connection.info` accessors.

        ((R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytinfoÔscsµˆjƒ‰yˆjƒ‰Wn$tjƒˆjƒWdQXnXˆjƒ‰tˆˆˆƒ}tj|‡‡‡‡fd†ƒˆ_	t
jˆƒˆr±ˆjj
dˆƒn|S(Ncstotˆˆˆ|ˆƒS(N(t_finalize_fairy(tref(RR6RƒRk(sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRMêss#Connection %r checked out from pool(Rwtget_connectionRtsafe_reraisetcheckint_should_log_debugR_tweakrefR†t	fairy_reft_refstaddRVRW(tclsRƒtfairy((RR6RƒRksD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytcheckoutÞs 


cCswd|_|j}|j}x&|jrC|jjƒ}||ƒqW|jjrf|jj||ƒn|j|ƒdS(N(	R*RŒRZR}RtpopR7R‰Rv(RRZRƒt	finalizer((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR‰õs			cCs |jdk	r|jƒndS(N(RZR*t_ConnectionRecord__close(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRscCsî|jdkrdS|r8|jjj|j||ƒn|jjj|j||ƒ|dk	r—|jjjd|r{dnd|j|jj	|ƒn(|jjjd|r²dnd|jƒ|r×t
j
ƒ|_n|jƒd|_dS(sžInvalidate the DBAPI connection held by this :class:`._ConnectionRecord`.

        This method is called for all connection invalidations, including
        when the :meth:`._ConnectionFairy.invalidate` or
        :meth:`.Connection.invalidate` methods are called, as well as when any
        so-called "automatic invalidation" condition occurs.

        :param e: an exception object indicating a reason for the invalidation.

        :param soft: if True, the connection isn't closed; instead, this
         connection will be recycled on next checkout.

         .. versionadded:: 1.0.3

        .. seealso::

            :ref:`pool_connection_invalidation`

        Ns*%sInvalidate connection %r (reason: %s:%s)sSoft ts%sInvalidate connection %r(
RZR*R}R7tsoft_invalidateRiRVR„t	__class__R!Rht_soft_invalidate_timeR”(Rtetsoft((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRis$

cCst}|jdkr_|jjƒ|jƒ|_|jjjr%|jjj|j|ƒq%nÆ|jj	dkr²t
j
ƒ|j|jj	kr²|jjjd|jƒt
}ns|jj|jkrí|jjjdd|jƒt
}n8|j|jkr%|jjjdd|jƒt
}n|rˆ|jƒ|jjƒd|_|jƒ|_|jjjrˆ|jjj|j|ƒqˆn|jS(Niÿÿÿÿs)Connection %r exceeded timeout; recyclings4Connection %r invalidated due to pool invalidation; t	recyclings:Connection %r invalidated due to local soft invalidation; (R4RZR*R„RR~R}R7RsR/RhRgRVR2R0R˜R”(RR>((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR‡/s@

	
	
	

	cCs$|jjƒ|jj|jƒdS(N(RRR}R[RZ(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt__closeXs
cCsry?tjƒ|_|jj|ƒ}|jjjd|ƒ|SWn,tk
rm}|jjjd|ƒ‚nXdS(NsCreated new connection %rsError on connect(): %s(RhRgR}RJRVRWRX(RRZR™((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt	__connect\sN(R!R"R#RGR*RZR˜RRR„tclassmethodR‘R‰RR4RiR‡R”R~(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRb s	
	
		+	)	cCs"tj|ƒ|dk	r,|j|k	r,dS|dk	r|rZ|rZ|jjd|ƒnyT|prt|||ƒ}|j|ksŠt‚|j	|ƒ|s­|j
|ƒnWqtk
r}|jjddt
ƒ|rï|jd|ƒnt|tƒs‚qqXn|r|jƒndS(sfCleanup for a :class:`._ConnectionFairy` whether or not it's already
    been garbage collected.

    Ns$Connection %r being returned to pools!Exception during reset or similarRUR™(RtdiscardR*RŒRVRWR_RZtAssertionErrort_resetR[t
BaseExceptionRYR2Rit
isinstanceRXR‰(RZRNRƒR†R6RR™((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR…gs0

	
	

R_cBsÂeZdZd„ZdZdZdZeddd„ƒZ	d„Z
d„ZeZd„Z
ed„ƒZed„ƒZejd„ƒZded	„Zd
„Zd„Zd„Zd
„ZRS(sXProxies a DBAPI connection and provides return-on-dereference
    support.

    This is an internal object used by the :class:`.Pool` implementation
    to provide context management to a DBAPI connection delivered by
    that :class:`.Pool`.

    The name "fairy" is inspired by the fact that the
    :class:`._ConnectionFairy` object's lifespan is transitory, as it lasts
    only for the length of a specific DBAPI connection being checked out from
    the pool, and additionally that as a transparent proxy, it is mostly
    invisible.

    .. seealso::

        :class:`._ConnectionRecord`

    cCs||_||_||_dS(N(RZRdt_echo(RRRNR6((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRG¥s		cCs‹|sKtj|ƒ}||_d|_|dk	rKtj|ƒ|_qKn|jdkrlt	j
dƒ‚n|jd7_|jjs—|jdkr›|Sd}xº|dkr]y$|jj|j|j|ƒ|SWq¤t	j
k
rY}|jjd|ƒ|jj|ƒy|jjƒ|_Wn'tjƒ|jjƒWdQXnX|d8}q¤Xq¤W|jjdƒ|jƒt	j
dƒ‚dS(NisThis connection is closediis&Disconnection detected on checkout: %ss+Reconnection attempts exhausted on checkout(RbR‘t_poolt_counterR*R‹R†RpRZRtInvalidRequestErrorR7RdtDisconnectionErrorRVR„RiR‡RRˆR‰(RRƒtthreadconnsRtattemptsR™((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR`Æs>			


cCstj|jd|ƒS(NR(R_R`R¥(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRrñscCs>t|j|j|jd|jd|ƒd|_d|_dS(NR(R…RZRdR¥R*R¤(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_checkinôs	cCs|jjr%|jj||jƒn|jtkr”|jrh|jjd|j|j	r^dndƒn|j	r|j	j
ƒq|jj|ƒno|jt
kr|jr×|jjd|j|j	rÍdndƒn|j	rð|j	jƒq|jj|ƒndS(Ns"Connection %s rollback-on-return%ss, via agentR•s Connection %s commit-on-return%s(R7tresetRdR3RR¤RVRWRZt_reset_agentRR9RRRR(RRƒ((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR¡üs$				cCs
|jjS(N(R¥RV(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_loggerscCs
|jdk	S(sbReturn True if this :class:`._ConnectionFairy` still refers
        to an active DBAPI connection.N(RZR*(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRescCs
|jjS(sInfo dictionary associated with the underlying DBAPI connection
        referred to by this :class:`.ConnectionFairy`, allowing user-defined
        data to be associated with the connection.

        The data here will follow along with the DBAPI connection including
        after it is returned to the connection pool and used again
        in subsequent instances of :class:`._ConnectionFairy`.  It is shared
        with the :attr:`._ConnectionRecord.info` and :attr:`.Connection.info`
        accessors.

        (RdR„(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR„s
cCse|jdkr tjdƒdS|jrE|jjd|d|ƒn|sad|_|jƒndS(sÎMark this connection as invalidated.

        This method can be called directly, and is also called as a result
        of the :meth:`.Connection.invalidate` method.   When invoked,
        the DBAPI connection is immediately closed and discarded from
        further use by the pool.  The invalidation mechanism proceeds
        via the :meth:`._ConnectionRecord.invalidate` internal method.

        :param e: an exception object indicating a reason for the invalidation.

        :param soft: if True, the connection isn't closed; instead, this
         connection will be recycled on next checkout.

         .. versionadded:: 1.0.3

        .. seealso::

            :ref:`pool_connection_invalidation`

        s.Can't invalidate an already-closed connection.NR™Rš(RZR*RtwarnRdRiR«(RR™Rš((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRi.s
		cOs|jj||ŽS(s˜Return a new DBAPI cursor for the underlying connection.

        This method is a proxy for the ``connection.cursor()`` DBAPI
        method.

        (RZtcursor(Rtargstkwargs((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR°MscCst|j|ƒS(N(RfRZ(Rtkey((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt__getattr__VscCsl|jdk	rhtj|jƒd|j_d|j_|jj|jƒ|jj	ƒ|_d|_ndS(s"Separate this connection from its Pool.

        This means that the connection will no longer be returned to the
        pool when closed, and will instead be literally closed.  The
        containing ConnectionRecord is separated from the DB-API connection,
        and will create a new connection when next used.

        Note that any overall connection limiting constraints imposed by a
        Pool implementation may be violated after a detach, as the detached
        connection is removed from the pool's knowledge and control.
        N(
RdR*RtremoveRŒRZR¥RtR„tcopy(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytdetachYs
cCs/|jd8_|jdkr+|jƒndS(Nii(R¦R«(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRosN(R!R"R#RGR*RZRdR­RžR`RrR«t_closeR¡RzR®ReRRR„R4RiR°R´R·R(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR_s&	*							tSingletonThreadPoolcBsPeZdZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z	RS(	s¤A Pool that maintains one connection per thread.

    Maintains one connection per each thread, never moving a connection to a
    thread other than the one which it was created in.

    .. warning::  the :class:`.SingletonThreadPool` will call ``.close()``
       on arbitrary connections that exist beyond the size setting of
       ``pool_size``, e.g. if more unique **thread identities**
       than what ``pool_size`` states are used.   This cleanup is
       non-deterministic and not sensitive to whether or not the connections
       linked to those thread identities are currently in use.

       :class:`.SingletonThreadPool` may be improved in a future release,
       however in its current status it is generally used only for test
       scenarios using a SQLite ``:memory:`` database and is not recommended
       for production use.


    Options are the same as those of :class:`.Pool`, as well as:

    :param pool_size: The number of threads in which to maintain connections
        at once.  Defaults to five.

    :class:`.SingletonThreadPool` is used by the SQLite dialect
    automatically when a memory-based database is used.
    See :ref:`sqlite_toplevel`.

    icKsEt|d<tj|||tjƒ|_tƒ|_||_dS(NR?(	R2R$RGRR,t_conntsett
_all_connstsize(RR=t	pool_sizetkw((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRG”s

cCsh|jjdƒ|j|jd|jd|jd|jd|jd|jd|j	d|j
d	|jƒS(
NsPool recreatingR¾R>R6R(R?R@RCR9(RVR„R—R.R½R/R6R)R1R3R7R9(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRn›s							cCsGx3|jD](}y|jƒWq
tk
r1q
Xq
W|jjƒdS(sDispose of this pool.N(R¼RRXR(RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRo§s
cCs<x5t|jƒ|jkr7|jjƒ}|jƒqWdS(N(RQR¼R½R’R(Rtc((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt_cleanup´scCsdt|ƒt|jƒfS(Ns"SingletonThreadPool id:%d size: %d(tidRQR¼(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRy¹scCsdS(N((RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRt½scCs‹y|jjƒ}|r|SWntk
r0nX|jƒ}tj|ƒ|j_t|jƒ|jkrw|j	ƒn|jj
|ƒ|S(N(RºRpRqRcR‹R†RQR¼R½RÁRŽ(RRÀ((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRwÀs

(
R!R"R#RGRnRoRÁRyRtRw(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR¹us		
			t	QueuePoolcBsƒeZdZdddd„Zd„Zd„Zd„Zd„Zd	„Zd
„Z	d„Z
d„Zd
„Zd„Z
d„ZRS(sÝA :class:`.Pool` that imposes a limit on the number of open connections.

    :class:`.QueuePool` is the default pooling implementation used for
    all :class:`.Engine` objects, unless the SQLite dialect is in use.

    ii
icKsWtj|||tj|ƒ|_d||_||_||_tj	ƒ|_
dS(sÿ
        Construct a QueuePool.

        :param creator: a callable function that returns a DB-API
          connection object, same as that of :paramref:`.Pool.creator`.

        :param pool_size: The size of the pool to be maintained,
          defaults to 5. This is the largest number of connections that
          will be kept persistently in the pool. Note that the pool
          begins with no connections; once this number of connections
          is requested, that number of connections will remain.
          ``pool_size`` can be set to 0 to indicate no size limit; to
          disable pooling, use a :class:`~sqlalchemy.pool.NullPool`
          instead.

        :param max_overflow: The maximum overflow size of the
          pool. When the number of checked-out connections reaches the
          size set in pool_size, additional connections will be
          returned up to this limit. When those additional connections
          are returned to the pool, they are disconnected and
          discarded. It follows then that the total number of
          simultaneous connections the pool will allow is pool_size +
          `max_overflow`, and the total number of "sleeping"
          connections the pool will allow is pool_size. `max_overflow`
          can be set to -1 to indicate no overflow limit; no limit
          will be placed on the total number of concurrent
          connections. Defaults to 10.

        :param timeout: The number of seconds to wait before giving up
          on returning a connection. Defaults to 30.

        :param \**kw: Other keyword arguments including
          :paramref:`.Pool.recycle`, :paramref:`.Pool.echo`,
          :paramref:`.Pool.reset_on_return` and others are passed to the
          :class:`.Pool` constructor.

        iN(R$RGt
sqla_queuetQueueR¥t	_overflowt
_max_overflowt_timeoutRtLockt_overflow_lock(RR=R¾tmax_overflowttimeoutR¿((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRGØs'
		cCsNy|jj|tƒWn0tjk
rIz|jƒWd|jƒXnXdS(N(R¥tputR4RÄtFullRt
_dec_overflow(RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRtscCs|jdk}y2|o'|j|jk}|jj||jƒSWn¸tjk
rû|rª|j|jkrª|s||jƒStj	d|j
ƒ|jƒ|jfƒ‚n|jƒrîy|j
ƒSWqøtjƒ|jƒWdQXqøXqü|jƒSnXdS(NiÿÿÿÿsPQueuePool limit of size %d overflow %d reached, connection timed out, timeout %d(RÇRÆR¥tgetRÈRÄtEmptyRwRtTimeoutErrorR½toverflowt
_inc_overflowRcRRˆRÏ(Rtuse_overflowtwait((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRws$
%
cCs_|jdkr"|jd7_tS|j.|j|jkrQ|jd7_tStSWdQXdS(Niÿÿÿÿi(RÇRÆR2RÊR4(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÔ(s
cCsI|jdkr"|jd8_tS|j|jd8_tSWdQXdS(Niÿÿÿÿi(RÇRÆR2RÊ(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÏ3s
cCs}|jjdƒ|j|jd|jjd|jd|jd|jd|j	d|j
d|jd	|jd
|j
d|jƒ
S(NsPool recreatingR¾RËRÌR>R6R(R?R@RCR9(RVR„R—R.R¥tmaxsizeRÇRÈR/R6R)R1R3R7R9(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRn;s						cCsuxBtrDy |jjtƒ}|jƒWqtjk
r@PqXqWd|jƒ|_|j	j
d|jƒƒdS(NisPool disposed. %s(R2R¥RÐR4RRÄRÑR½RÆRVR„Ry(RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRoGs		cCs,d|jƒ|jƒ|jƒ|jƒfS(Ns_Pool size: %d  Connections in pool: %d Current Overflow: %d Current Checked out connections: %d(R½t	checkedinRÓt
checkedout(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRyRs
			cCs
|jjS(N(R¥R×(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR½ZscCs
|jjƒS(N(R¥tqsize(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRØ]scCs|jS(N(RÆ(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÓ`scCs|jj|jjƒ|jS(N(R¥R×RÚRÆ(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÙcs(R!R"R#RGRtRwRÔRÏRnRoRyR½RØRÓRÙ(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÃÏs.											tNullPoolcBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sýA Pool which does not pool connections.

    Instead it literally opens and closes the underlying DB-API connection
    per each connection open/close.

    Reconnect-related functions such as ``recycle`` and connection
    invalidation are not supported by this Pool implementation, since
    no connections are held persistently.

    .. versionchanged:: 0.7
        :class:`.NullPool` is used by the SQlite dialect automatically
        when a file-based database is used. See :ref:`sqlite_toplevel`.

    cCsdS(NRÛ((R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRyxscCs|jƒdS(N(R(RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRt{scCs
|jƒS(N(Rc(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRw~scCs_|jjdƒ|j|jd|jd|jd|jd|jd|jd|j	d|j
ƒS(	NsPool recreatingR>R6R(R?R@RCR9(RVR„R—R.R/R6R)R1R3R7R9(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRns						cCsdS(N((R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRos(R!R"R#RyRtRwRnRo(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÛgs				t
StaticPoolcBsbeZdZed„ƒZed„ƒZd„Zd„Zd„Zd„Z	d„Z
d„ZRS(	s.A Pool of exactly one connection, used for all requests.

    Reconnect-related functions such as ``recycle`` and connection
    invalidation (which is also used to support auto-reconnect) are not
    currently supported by this Pool implementation but may be implemented
    in a future release.

    cCs
|jƒS(N(R.(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRºœscCs
t|ƒS(N(Rb(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRZ scCsdS(NRÜ((R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRy¤scCs,d|jkr(|jjƒd|_ndS(NRº(RHRºRR*(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRo§s
cCsb|jjdƒ|jd|jd|jd|jd|jd|jd|jd|j	d	|j
ƒS(
NsPool recreatingR=R>R?R@R6R(RCR9(RVR„R—R.R/R1R3R6R)R7R9(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRn¬s						cCs|jS(N(Rº(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRc·scCsdS(N((RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRtºscCs|jS(N(RZ(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRw½s(R!R"R#RRºRZRyRoRnRcRtRw(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRܑs						t
AssertionPoolcBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(sÉA :class:`.Pool` that allows at most one checked out connection at
    any given time.

    This will raise an exception if more than one connection is checked out
    at a time.  Useful for debugging code that is using more connections
    than desired.

    .. versionchanged:: 0.7
        :class:`.AssertionPool` also logs a traceback of where
        the original connection was checked out, and reports
        this in the assertion error raised.

    cOsGd|_t|_|jdtƒ|_d|_tj	|||ŽdS(Ntstore_traceback(
R*RºR4t_checked_outR’R2t_store_tracebackt_checkout_tracebackR$RG(RR±R¿((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRGÑs
			cCsdS(NRÝ((R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRyØscCs:|jstdƒ‚nt|_||jks6t‚dS(Nsconnection is not checked out(RßR R4Rº(RRx((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRtÛs		cCs&t|_|jr"|jjƒndS(N(R4RßRºR(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRoás		c
CsD|jjdƒ|j|jd|jd|jd|jd|jƒS(NsPool recreatingR6R(RCR9(RVR„R—R.R6R)R7R9(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRnæs
		cCs|jrJ|jr1ddjt|jƒƒ}nd}td|ƒ‚n|jse|jƒ|_nt|_|jr‰t	j
ƒ|_n|jS(Ns at:
%sR•s!connection is already checked out(RßRátjoinRR RºRcR2Ràt	tracebacktformat_stack(Rtsuffix((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRwís						(	R!R"R#RGRyRtRoRnRw(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRÝÁs					R
cBsYeZdZed„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„ZRS(	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.
    cKs7||_||_||_i|_tjƒ|_dS(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(RR¿t	poolclasstpoolsRRÉt_create_pool_mutex(RRRæR¿((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRGs

				cCs(x!t|jƒD]}|j|=qWdS(N(tlistRç(RR³((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRscCs|jƒdS(N(R(R((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt__del__scCst|j|ƒS(N(RfR(RR³((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR´"scsºˆjˆˆŽ}yˆj|SWn’tk
rµˆjjƒzc|ˆjkr•ˆjddƒˆj‡‡‡fd†ˆj}|ˆj|<|Sˆj|SWdˆjj	ƒXnXdS(Ntsa_pool_keycsˆjjˆˆŽS(N(RRs((R±R¿R(sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRM/s(
t
_serializeRçRRètacquireR’R*RæR¿trelease(RR±R¿R³Rƒ((R±R¿RsD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pytget_pool%s


cOs|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ïRs(RR±R¿((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRs7scOs8|j||Ž}y|j|=Wntk
r3nXdS(s;Dispose the pool referenced by the given connect arguments.N(RìRçR(RR±R¿R³((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRoGs

cOsKd|kr|dStt|ƒgt|ƒD]}|||f^q-ƒS(NRë(ttupleRétsorted(RR±R¿tk((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyRìPs
	(R!R"R#RÃRGRRêR´RïRsRoRì(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyR
ÿs							((R#RhRãR‹R•RRRRRRRÄRRRtcollectionsR	R
RRtsymbolRRRtobjectRt
IdentifiedR$RbR*R…R»RR_R¹RÃRÛRÜRÝR
(((sD/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/pool.pyt<module>s4(		
ÿEÈ%	åZ˜*0>