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ÿdZddlZddlmZmZmZmZddlmZm	Z	ddlm
Z
mZmZmZm
Z
mZddlmZdd	lmZmZmZmZmZmZmZmZddlZdd
lmZddlmZddlmZddl Z d
dddgZ!ej"ƒZ#d„Z$de%fd„ƒYZ&ej'dƒZ(ej'dƒZ)ej'dƒZ*ej'dƒZ+ej'dƒZ,de%fd„ƒYZ-d
e&fd„ƒYZ.de&fd„ƒYZ/d„Z0d„Z1d„Z2ej3ƒZ4dS(s1Provides the Session class and related utilities.iÿÿÿÿNi(tutiltsqltenginetexc(Rt
expressioni(tSessionExtensiont
attributesRtquerytloadingtidentity(tinspect(t
object_mappertclass_mappert_class_to_mappert
_state_mappertobject_statet	_none_sett	state_strtinstance_str(tpersistence(tUOWTransaction(tstatetSessiontSessionTransactionRtsessionmakercCs3|jr/yt|jSWq/tk
r+q/XndS(s_Given an :class:`.InstanceState`, return the :class:`.Session`
        associated, if any.
    N(t
session_idt	_sessionstKeyErrortNone(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_state_session%s	
t_SessionClassMethodscBsJeZdZed„ƒZeejdƒd„ƒƒZed„ƒZRS(sBClass-level methods for :class:`.Session`, :class:`.sessionmaker`.cCs%xtjƒD]}|jƒq
WdS(sClose *all* sessions in memory.N(Rtvaluestclose(tclstsess((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt	close_all4sssqlalchemy.orm.utilcOs|j||ŽS(sZReturn an identity key.

        This is an alias of :func:`.util.identity_key`.

        (tidentity_key(R!torm_utiltargstkwargs((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR$;scCs
t|ƒS(sxReturn the :class:`.Session` to which an object belongs.

        This is an alias of :func:`.object_session`.

        (tobject_session(R!tinstance((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR(Es(	t__name__t
__module__t__doc__tclassmethodR#RtdependenciesR$R((((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR1s
	tACTIVEtPREPAREDt	COMMITTEDtDEACTIVEtCLOSEDcBseZdZdZded„Zed„ƒZeZ	ed„ƒZ
eeedd„Zed„ƒZdd„Z
ed„Zdd	„Zd
„Zed„Zd„Zd
„Zd„Zd„Zd„Zed„Zd„Zed„Zd„Zd„ZRS(sA :class:`.Session`-level transaction.

    :class:`.SessionTransaction` is a mostly behind-the-scenes object
    not normally referenced directly by application code.   It coordinates
    among multiple :class:`.Connection` objects, maintaining a database
    transaction for each one individually, committing or rolling them
    back all at once.   It also provides optional two-phase commit behavior
    which can augment this coordination operation.

    The :attr:`.Session.transaction` attribute of :class:`.Session`
    refers to the current :class:`.SessionTransaction` object in use, if any.
    The :attr:`.SessionTransaction.parent` attribute refers to the parent
    :class:`.SessionTransaction` in the stack of :class:`.SessionTransaction`
    objects.  If this attribute is ``None``, then this is the top of the stack.
    If non-``None``, then this :class:`.SessionTransaction` refers either
    to a so-called "subtransaction" or a "nested" transaction.  A
    "subtransaction" is a scoping concept that demarcates an inner portion
    of the outermost "real" transaction.  A nested transaction, which
    is indicated when the :attr:`.SessionTransaction.nested`
    attribute is also True, indicates that this :class:`.SessionTransaction`
    corresponds to a SAVEPOINT.

    **Life Cycle**

    A :class:`.SessionTransaction` is associated with a :class:`.Session`
    in its default mode of ``autocommit=False`` immediately, associated
    with no database connections.  As the :class:`.Session` is called upon
    to emit SQL on behalf of various :class:`.Engine` or :class:`.Connection`
    objects, a corresponding :class:`.Connection` and associated
    :class:`.Transaction` is added to a collection within the
    :class:`.SessionTransaction` object, becoming one of the
    connection/transaction pairs maintained by the
    :class:`.SessionTransaction`.  The start of a :class:`.SessionTransaction`
    can be tracked using the :meth:`.SessionEvents.after_transaction_create`
    event.

    The lifespan of the :class:`.SessionTransaction` ends when the
    :meth:`.Session.commit`, :meth:`.Session.rollback` or
    :meth:`.Session.close` methods are called.  At this point, the
    :class:`.SessionTransaction` removes its association with its parent
    :class:`.Session`.   A :class:`.Session` that is in ``autocommit=False``
    mode will create a new :class:`.SessionTransaction` to replace it
    immediately, whereas a :class:`.Session` that's in ``autocommit=True``
    mode will remain without a :class:`.SessionTransaction` until the
    :meth:`.Session.begin` method is called.  The end of a
    :class:`.SessionTransaction` can be tracked using the
    :meth:`.SessionEvents.after_transaction_end` event.

    **Nesting and Subtransactions**

    Another detail of :class:`.SessionTransaction` behavior is that it is
    capable of "nesting".  This means that the :meth:`.Session.begin` method
    can be called while an existing :class:`.SessionTransaction` is already
    present, producing a new :class:`.SessionTransaction` that temporarily
    replaces the parent :class:`.SessionTransaction`.   When a
    :class:`.SessionTransaction` is produced as nested, it assigns itself to
    the :attr:`.Session.transaction` attribute, and it additionally will assign
    the previous :class:`.SessionTransaction` to its :attr:`.Session.parent`
    attribute.  The behavior is effectively a
    stack, where :attr:`.Session.transaction` refers to the current head of
    the stack, and the :attr:`.SessionTransaction.parent` attribute allows
    traversal up the stack until :attr:`.SessionTransaction.parent` is
    ``None``, indicating the top of the stack.

    When the scope of :class:`.SessionTransaction` is ended via
    :meth:`.Session.commit` or :meth:`.Session.rollback`, it restores its
    parent :class:`.SessionTransaction` back onto the
    :attr:`.Session.transaction` attribute.

    The purpose of this stack is to allow nesting of
    :meth:`.Session.rollback` or :meth:`.Session.commit` calls in context
    with various flavors of :meth:`.Session.begin`. This nesting behavior
    applies to when :meth:`.Session.begin_nested` is used to emit a
    SAVEPOINT transaction, and is also used to produce a so-called
    "subtransaction" which allows a block of code to use a
    begin/rollback/commit sequence regardless of whether or not its enclosing
    code block has begun a transaction.  The :meth:`.flush` method, whether
    called explicitly or via autoflush, is the primary consumer of the
    "subtransaction" feature, in that it wishes to guarantee that it works
    within in a transaction block regardless of whether or not the
    :class:`.Session` is in transactional mode when the method is called.

    Note that the flush process that occurs within the "autoflush" feature
    as well as when the :meth:`.Session.flush` method is used **always**
    creates a :class:`.SessionTransaction` object.   This object is normally
    a subtransaction, unless the :class:`.Session` is in autocommit mode
    and no transaction exists at all, in which case it's the outermost
    transaction.   Any event-handling logic or other inspection logic
    needs to take into account whether a :class:`.SessionTransaction`
    is the outermost transaction, a subtransaction, or a "nested" / SAVEPOINT
    transaction.

    .. seealso::

    :meth:`.Session.rollback`

    :meth:`.Session.commit`

    :meth:`.Session.begin`

    :meth:`.Session.begin_nested`

    :attr:`.Session.is_active`

    :meth:`.SessionEvents.after_transaction_create`

    :meth:`.SessionEvents.after_transaction_end`

    :meth:`.SessionEvents.after_commit`

    :meth:`.SessionEvents.after_rollback`

    :meth:`.SessionEvents.after_soft_rollback`

    cCs”||_i|_||_||_t|_|rL|rLtjdƒ‚n|jjre|j	ƒn|jj
jr|jj
j|j|ƒndS(NsOCan't start a SAVEPOINT transaction when no existing transaction is in progress(tsessiont_connectionst_parenttnestedR/t_statetsa_exctInvalidRequestErrort_enable_transaction_accountingt_take_snapshottdispatchtafter_transaction_create(tselfR4tparentR7((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt__init__Îs					

cCs|jS(sjThe parent :class:`.SessionTransaction` of this
        :class:`.SessionTransaction`.

        If this attribute is ``None``, indicates this
        :class:`.SessionTransaction` is at the top of the stack, and
        corresponds to a real "COMMIT"/"ROLLBACK"
        block.  If non-``None``, then this is either a "subtransaction"
        or a "nested" / SAVEPOINT transaction.  If the
        :attr:`.SessionTransaction.nested` attribute is ``True``, then
        this is a SAVEPOINT, and if ``False``, indicates this a subtransaction.

        .. versionadded:: 1.0.16 - use ._parent for previous versions

        (R6(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR@ßscCs|jdk	o|jtkS(N(R4RR8R/(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt	is_activeùssThis transaction is closedcCsÍ|jtkr!tjdƒ‚n¨|jtkrK|sÉtjdƒ‚qÉn~|jtkr¨|rÉ|rÉ|jrŠtjd|jƒ‚q¥|s¥tjdƒ‚q¥qÉn!|jtkrÉtj|ƒ‚ndS(Ns\This session is in 'committed' state; no further SQL can be emitted within this transaction.s[This session is in 'prepared' state; no further SQL can be emitted within this transaction.sÂThis Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: %ss‰This Session's transaction has been rolled back by a nested rollback() call.  To begin a new transaction, issue Session.rollback() first.(	R8R1R9R:R0R2t_rollback_exceptionR3tResourceClosedError(R?tprepared_oktrollback_oktdeactive_okt
closed_msg((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_assert_activeýs$	cCs|jp|jS(N(R7R6(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_is_transaction_boundary scKs/|jƒ|jj||}|j||ƒS(N(RIR4tget_bindt_connection_for_bind(R?tbindkeytexecution_optionsR'tbind((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt
connection$s
cCs |jƒt|j|d|ƒS(NR7(RIRR4(R?R7((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_begin)s
cCsk|}d}xX|rf||f7}|j|kr5Pq|jdkrZtjd|ƒ‚q|j}qW|S(Ns4Transaction %s is not on the active transaction list((R6RR9R:(R?tuptotcurrenttresult((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_iterate_parents.s	


cCs¥|jsI|jj|_|jj|_|jj|_|jj|_dS|jjse|jjƒnt	j
ƒ|_t	j
ƒ|_t	j
ƒ|_t	j
ƒ|_dS(N(RJR6t_newt_deletedt_dirtyt
_key_switchesR4t	_flushingtflushtweakreftWeakKeyDictionary(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR<?s	cCsr|jst‚xHt|jƒj|jjƒD](}|jj|ƒ|jr.|`q.q.WxR|jj	ƒD]A\}\}}|jj
j|ƒ||_|jj
j|ƒqjWxNt|j
ƒj|jj
ƒD].}|jræ|`n|jj|dtƒqÎW|jj
st‚xX|jj
jƒD]D}|sK|jsK||jkr&|j|j|jj
jƒq&q&WdS(Ntdiscard_existing(RJtAssertionErrortsetRVtunionR4t_expunge_statetkeyRYtitemstidentity_maptsafe_discardtreplaceRWtdeletedt_update_impltTruet
all_statestmodifiedRXt_expiretdictt	_modified(R?t
dirty_onlytstoldkeytnewkey((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_restore_snapshotOs"%	
"	%		cCsú|jst‚|jr’|jjr’x6|jjjƒD]"}|j|j|jjj	ƒq8Wx!t
|jƒD]}|jƒqnW|jj
ƒnd|jrö|jjj|jƒ|jjj|jƒ|jjj|jƒ|jjj|jƒndS(N(RJR_R7R4texpire_on_commitReRkRmRnRotlistRWt_detachtclearR6RVtupdateRXRY(R?Rq((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_remove_snapshoths 	cCsg|jƒ||jkr>|r/tjdƒn|j|dS|jrl|jj||ƒ}|js·|SnKt|tj	ƒr«|}|j|jkr·t
jdƒ‚q·n|jƒ}|rÏ|j
|}n|jjrù|jdkrù|jƒ}n$|jr|jƒ}n|jƒ}||||k	f|j|<|j|j<|jjj|j||ƒ|S(NsOConnection is already established for the given bind; execution_options ignoredisMSession already has a Connection associated for the given Connection's Engine(RIR5RtwarnR6RLR7t
isinstanceRt
ConnectionR9R:tcontextual_connectRNR4ttwophaseRtbegin_twophasetbegin_nestedtbeginR=tafter_begin(R?RORNtconnttransaction((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRLws4

			*cCs<|jdk	s|jjr.tjdƒ‚n|jƒdS(NsD'twophase' mode not enabled, or not root transaction; can't prepare.(R6RR4RR9R:t
_prepare_impl(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytpreparežscCsV|jƒ|jdks"|jr;|jjj|jƒn|jj}||k	r}x'|jd|ƒD]}|j	ƒqfWn|jj
sÒxFtdƒD]&}|jjƒr¯Pn|jj
ƒq–Wtjdƒ‚n|jdkrI|jjrIy2x+t|jjƒƒD]}|djƒqWWqItjƒ|jƒWdQXqIXnt|_dS(NRRidsrOver 100 subsequent flushes have occurred within session.commit() - is an after_flush() hook creating new objects?i(RIR6RR7R4R=t
before_commitR…RUtcommitRZtranget	_is_cleanR[Rt
FlushErrorRR`R5RR‡Rtsafe_reraisetrollbackR0R8(R?tstxtsubtransactiont_flush_guardtt((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR†¥s,

cCs¾|jdtƒ|jtk	r,|jƒn|jdksD|jr­x+t|j	j
ƒƒD]}|djƒqZWt|_|j
jj|j
ƒ|j
jr­|jƒq­n|jƒ|jS(NREi(RIRjR8R0R†R6RR7R`R5RR‰R1R4R=tafter_commitR;RzR (R?R’((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR‰Äs
	
cCsY|jdtdtƒ|jj}||k	rXx'|jd|ƒD]}|jƒqAWn|}|jttfkrËxU|jƒD]D}|j	dksž|jr»|jƒt
|_|}Pq€t
|_q€Wn|j}|jr
|jƒr
tjdƒ|jd|jƒn|jƒ|j	r?|r?tjƒd|j	_n|jj||ƒ|j	S(NRERFRRs\Session's state has been changed on a non-active transaction - this state will be discarded.Rpi(RIRjR4R…RUR R8R/R0R6RR7t_rollback_implR2R;R‹RR{Rttsystexc_infoRCR=tafter_soft_rollback(R?t_capture_exceptionRRtboundaryR…R"((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRŽÖs2
			

cCsjx+t|jjƒƒD]}|djƒqW|jjrP|jd|jƒn|jjj	|jƒdS(NiRp(
R`R5RRŽR4R;RtR7R=tafter_rollback(R?R’((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR”þs
cCsò|j|j_|jdkrzxYt|jjƒƒD]?\}}}|rV|jƒn|ri|jƒq4|jƒq4Wnt	|_
|jjjr®|jjj|j|ƒn|jdkrÜ|jj
sÜ|jjƒqÜnd|_d|_dS(N(R6R4R…RR`R5Rt
invalidateR R3R8R=tafter_transaction_endt
autocommitR‚(R?R›RPR…t	autoclose((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR s""

		cCs|S(N((R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt	__enter__scCs~|jdtdtƒ|jjdkr,dS|dkrpy|jƒWqztjƒ|jƒWdQXqzXn
|jƒdS(NRGRE(	RIRjR4R…RR‰RRRŽ(R?ttypetvaluet	traceback((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt__exit__ s
N(R*R+R,RRCtFalseRAtpropertyR@R7RBRIRJRPRQRUR<RtRzRLR‡R†R‰RŽR”R RŸR£(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRWs4s 			'			(			cBs5eZdZd]Zd^eeeeeed^d^d^ejd„Z	d^Z
d^Zej
d„ƒZeed„Zd„Zd„Zd „Zd!„Zd^d^d^ed^d"„Zd^d#„Zd^d^d^d$„Zd^d^d^d%„Zd&„Zd'„Zd(„Zd)„Zd*„Zd+„Zd,„Zd^d^d-„Zd.„Ze ej!d/„ƒƒZ"d0„Z#d^d^d1„Z$d2„Z%d^d3„Z&d4„Z'd5„Z(ej)d6d7ƒd8„ƒZ*d9„Z+d:„Z,d;„Z-d<„Z.d=„Z/ed>„Z0d?„Z1d@„Z2dA„Z3edB„Z4ed^dC„Z5dD„Z6dE„Z7edF„Z8dG„Z9dH„Z:dI„Z;edJ„Z<edK„Z=dL„Z>dM„Z?dN„Z@d^dO„ZAdP„ZBdQ„ZCd^dR„ZDeedS„ZEedT„ZFdU„ZGdV„ZHeedW„ZIe dX„ƒZJd^ZKe dY„ƒZLe dZ„ƒZMe d[„ƒZNe d\„ƒZORS(_s„Manages persistence operations for ORM-mapped objects.

    The Session's usage paradigm is described at :doc:`/orm/session`.


    t__contains__t__iter__taddtadd_allR‚RR R‰RPtdeletetexecutetexpiret
expire_alltexpungetexpunge_allR[RKtis_modifiedtbulk_save_objectstbulk_insert_mappingstbulk_update_mappingstmergeRtrefreshRŽtscalarcCsm|rtj|_ntjdƒtj|_|jƒ|_i|_i|_||_	i|_
t|_t|_
d|_tƒ|_||_||_||_||_||_||_|
r×|jj|
ƒn|	r
x*tj|	ƒD]}tj||ƒqíWn|dk	rFx-|jƒD]\}
}|j|
|ƒq#Wn|js\|jƒn|t |j<dS(sConstruct a new Session.

        See also the :class:`.sessionmaker` function which is used to
        generate a :class:`.Session`-producing callable with a given
        set of arguments.

        :param autocommit:

          .. warning::

             The autocommit flag is **not for general use**, and if it is
             used, queries should only be invoked within the span of a
             :meth:`.Session.begin` / :meth:`.Session.commit` pair.  Executing
             queries outside of a demarcated transaction is a legacy mode
             of usage, and can in some cases lead to concurrent connection
             checkouts.

          Defaults to ``False``. When ``True``, the
          :class:`.Session` does not keep a persistent transaction running,
          and will acquire connections from the engine on an as-needed basis,
          returning them immediately after their use. Flushes will begin and
          commit (or possibly rollback) their own transaction if no
          transaction is present. When using this mode, the
          :meth:`.Session.begin` method is used to explicitly start
          transactions.

          .. seealso::

            :ref:`session_autocommit`

        :param autoflush: When ``True``, all query operations will issue a
           :meth:`~.Session.flush` call to this ``Session`` before proceeding.
           This is a convenience feature so that :meth:`~.Session.flush` need
           not be called repeatedly in order for database queries to retrieve
           results. It's typical that ``autoflush`` is used in conjunction
           with ``autocommit=False``. In this scenario, explicit calls to
           :meth:`~.Session.flush` are rarely needed; you usually only need to
           call :meth:`~.Session.commit` (which flushes) to finalize changes.

        :param bind: An optional :class:`.Engine` or :class:`.Connection` to
           which this ``Session`` should be bound. When specified, all SQL
           operations performed by this session will execute via this
           connectable.

        :param binds: An optional dictionary which contains more granular
           "bind" information than the ``bind`` parameter provides. This
           dictionary can map individual :class`.Table`
           instances as well as :class:`~.Mapper` instances to individual
           :class:`.Engine` or :class:`.Connection` objects. Operations which
           proceed relative to a particular :class:`.Mapper` will consult this
           dictionary for the direct :class:`.Mapper` instance as
           well as the mapper's ``mapped_table`` attribute in order to locate
           a connectable to use. The full resolution is described in the
           :meth:`.Session.get_bind`.
           Usage looks like::

            Session = sessionmaker(binds={
                SomeMappedClass: create_engine('postgresql://engine1'),
                somemapper: create_engine('postgresql://engine2'),
                some_table: create_engine('postgresql://engine3'),
                })

          Also see the :meth:`.Session.bind_mapper`
          and :meth:`.Session.bind_table` methods.

        :param \class_: Specify an alternate class other than
           ``sqlalchemy.orm.session.Session`` which should be used by the
           returned class. This is the only argument that is local to the
           :class:`.sessionmaker` function, and is not sent directly to the
           constructor for ``Session``.

        :param _enable_transaction_accounting:  Defaults to ``True``.  A
           legacy-only flag which when ``False`` disables *all* 0.5-style
           object accounting on transaction boundaries, including auto-expiry
           of instances on rollback and commit, maintenance of the "new" and
           "deleted" lists upon rollback, and autoflush of pending changes
           upon :meth:`~.Session.begin`, all of which are interdependent.

        :param expire_on_commit:  Defaults to ``True``. When ``True``, all
           instances will be fully expired after each :meth:`~.commit`,
           so that all attribute/object access subsequent to a completed
           transaction will load from the most recent database state.

        :param extension: An optional
           :class:`~.SessionExtension` instance, or a list
           of such instances, which will receive pre- and post- commit and
           flush events, as well as a post-rollback event. **Deprecated.**
           Please see :class:`.SessionEvents`.

        :param info: optional dictionary of arbitrary data to be associated
           with this :class:`.Session`.  Is available via the
           :attr:`.Session.info` attribute.  Note the dictionary is copied at
           construction time so that modifications to the per-
           :class:`.Session` dictionary will be local to that
           :class:`.Session`.

           .. versionadded:: 0.9.0

        :param query_cls:  Class which should be used to create new Query
          objects, as returned by the :meth:`~.Session.query` method.
          Defaults to :class:`.Query`.

        :param twophase:  When ``True``, all transactions will be started as
            a "two phase" transaction, i.e. using the "two phase" semantics
            of the database in use along with an XID.  During a
            :meth:`~.commit`, after :meth:`~.flush` has been issued for all
            attached databases, the :meth:`~.TwoPhaseTransaction.prepare`
            method on each database's :class:`.TwoPhaseTransaction` will be
            called. This allows each database to roll back the entire
            transaction, before each transaction is committed.

        :param weak_identity_map:  Defaults to ``True`` - when set to
           ``False``, objects placed in the :class:`.Session` will be
           strongly referenced until explicitly removed or the
           :class:`.Session` is closed.  **Deprecated** - this option
           is present to allow compatibility with older applications, but
           it is recommended that strong references to objects
           be maintained by the calling application
           externally to the :class:`.Session` itself,
           to the extent that is required by the application.

        s%weak_identity_map=False is deprecated.  It is present to allow compatibility with older applications, but it is recommended that strong references to objects be maintained by the calling application externally to the :class:`.Session` itself, to the extent that is required by the application.N(!R	tWeakInstanceDictt
_identity_clsRtwarn_deprecatedtStrongInstanceDictReRVRWROt_Session__bindsR¤RZt_warn_on_eventsRR…t_new_sessionidthash_keyt	autoflushRRuR;Rt
_query_clstinfoRytto_listRt_adapt_listenerRdt	_add_bindR‚R(R?ROR¿RuR;RRtweak_identity_maptbindst	extensionRÁt	query_clstextRc((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRA?s>														
cCsiS(s«A user-modifiable dictionary.

        The initial value of this dictionary can be populated using the
        ``info`` argument to the :class:`.Session` constructor or
        :class:`.sessionmaker` constructor or factory methods.  The dictionary
        here is always local to this :class:`.Session` and can be modified
        independently of all other :class:`.Session` objects.

        .. versionadded:: 0.9.0

        ((R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRÁñs
cCsd|jdk	rH|s|r6|jjd|ƒ|_q]tjdƒ‚nt|d|ƒ|_|jS(sìBegin a transaction on this :class:`.Session`.

        If this Session is already within a transaction, either a plain
        transaction or nested transaction, an error is raised, unless
        ``subtransactions=True`` or ``nested=True`` is specified.

        The ``subtransactions=True`` flag indicates that this
        :meth:`~.Session.begin` can create a subtransaction if a transaction
        is already in progress. For documentation on subtransactions, please
        see :ref:`session_subtransactions`.

        The ``nested`` flag begins a SAVEPOINT transaction and is equivalent
        to calling :meth:`~.Session.begin_nested`. For documentation on
        SAVEPOINT transactions, please see :ref:`session_begin_nested`.

        R7sSA transaction is already begun.  Use subtransactions=True to allow subtransactions.N(R…RRQR9R:R(R?tsubtransactionsR7((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR‚scCs|jdtƒS(sBegin a `nested` transaction on this Session.

        The target database(s) must support SQL SAVEPOINTs or a
        SQLAlchemy-supported vendor implementation of the idea.

        For documentation on SAVEPOINT
        transactions, please see :ref:`session_begin_nested`.

        R7(R‚Rj(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRs
cCs#|jdkrn
|jjƒdS(sØRollback the current transaction in progress.

        If no transaction is in progress, this method is a pass-through.

        This method rolls back the current transaction or nested transaction
        regardless of subtransactions being in effect.  All subtransactions up
        to the first real transaction are closed.  Subtransactions occur when
        :meth:`.begin` is called multiple times.

        .. seealso::

            :ref:`session_rollback`

        N(R…RRŽ(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRŽ*scCsH|jdkr7|js%|jƒq7tjdƒ‚n|jjƒdS(s“Flush pending changes and commit the current transaction.

        If no transaction is in progress, this method raises an
        :exc:`~sqlalchemy.exc.InvalidRequestError`.

        By default, the :class:`.Session` also expires all database
        loaded state on all ORM-managed attributes after transaction commit.
        This so that subsequent operations load the most recent
        data from the database.   This behavior can be disabled using
        the ``expire_on_commit=False`` option to :class:`.sessionmaker` or
        the :class:`.Session` constructor.

        If a subtransaction is in effect (which occurs when begin() is called
        multiple times), the subtransaction will be closed, and the next call
        to ``commit()`` will operate on the enclosing transaction.

        When using the :class:`.Session` in its default mode of
        ``autocommit=False``, a new transaction will
        be begun immediately after the commit, but note that the newly begun
        transaction does *not* use any connection resources until the first
        SQL is actually emitted.

        .. seealso::

            :ref:`session_committing`

        sNo transaction is begun.N(R…RRR‚R9R:R‰(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR‰>s
	
cCsH|jdkr7|js%|jƒq7tjdƒ‚n|jjƒdS(sxPrepare the current transaction in progress for two phase commit.

        If no transaction is in progress, this method raises an
        :exc:`~sqlalchemy.exc.InvalidRequestError`.

        Only root transactions of two phase sessions can be prepared. If the
        current transaction is not such, an
        :exc:`~sqlalchemy.exc.InvalidRequestError` is raised.

        sNo transaction is begun.N(R…RRR‚R9R:R‡(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR‡bs
	
cKs@|dkr'|j|d||}n|j|d|d|ƒS(s­
Return a :class:`.Connection` object corresponding to this
        :class:`.Session` object's transactional state.

        If this :class:`.Session` is configured with ``autocommit=False``,
        either the :class:`.Connection` corresponding to the current
        transaction is returned, or if no transaction is in progress, a new
        one is begun and the :class:`.Connection` returned (note that no
        transactional state is established with the DBAPI until the first
        SQL statement is emitted).

        Alternatively, if this :class:`.Session` is configured with
        ``autocommit=True``, an ad-hoc :class:`.Connection` is returned
        using :meth:`.Engine.contextual_connect` on the underlying
        :class:`.Engine`.

        Ambiguity in multi-bind or unbound :class:`.Session` objects can be
        resolved through any of the optional keyword arguments.   This
        ultimately makes usage of the :meth:`.get_bind` method for resolution.

        :param bind:
          Optional :class:`.Engine` to be used as the bind.  If
          this engine is already involved in an ongoing transaction,
          that connection will be used.  This argument takes precedence
          over ``mapper``, ``clause``.

        :param mapper:
          Optional :func:`.mapper` mapped class, used to identify
          the appropriate bind.  This argument takes precedence over
          ``clause``.

        :param clause:
            A :class:`.ClauseElement` (i.e. :func:`~.sql.expression.select`,
            :func:`~.sql.expression.text`,
            etc.) which will be used to locate a bind, if a bind
            cannot otherwise be identified.

        :param close_with_result: Passed to :meth:`.Engine.connect`,
          indicating the :class:`.Connection` should be considered
          "single use", automatically closing when the first result set is
          closed.  This flag only has an effect if this :class:`.Session` is
          configured with ``autocommit=True`` and does not already have a
          transaction in progress.

        :param execution_options: a dictionary of execution options that will
         be passed to :meth:`.Connection.execution_options`, **when the
         connection is first procured only**.   If the connection is already
         present within the :class:`.Session`, a warning is emitted and
         the arguments are ignored.

         .. versionadded:: 0.9.9

         .. seealso::

            :ref:`session_transaction_isolation`

        :param \**kw:
          Additional keyword arguments are sent to :meth:`get_bind()`,
          allowing additional arguments to be passed to custom
          implementations of :meth:`get_bind`.

        tclausetclose_with_resultRNN(RRKRL(R?tmapperRËRORÌRNtkw((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRPus
BcKsQ|jdk	r"|jj||ƒS|j|}|rI|j|}n|SdS(N(R…RRLR~RN(R?RRNRÎR„((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRL¾s	
cKs[tj|ƒ}|dkr6|j|d||}n|j|dtƒj||pWiƒS(sExecute a SQL expression construct or string statement within
        the current transaction.

        Returns a :class:`.ResultProxy` representing
        results of the statement execution, in the same manner as that of an
        :class:`.Engine` or
        :class:`.Connection`.

        E.g.::

            result = session.execute(
                        user_table.select().where(user_table.c.id == 5)
                    )

        :meth:`~.Session.execute` accepts any executable clause construct,
        such as :func:`~.sql.expression.select`,
        :func:`~.sql.expression.insert`,
        :func:`~.sql.expression.update`,
        :func:`~.sql.expression.delete`, and
        :func:`~.sql.expression.text`.  Plain SQL strings can be passed
        as well, which in the case of :meth:`.Session.execute` only
        will be interpreted the same as if it were passed via a
        :func:`~.expression.text` construct.  That is, the following usage::

            result = session.execute(
                        "SELECT * FROM user WHERE id=:param",
                        {"param":5}
                    )

        is equivalent to::

            from sqlalchemy import text
            result = session.execute(
                        text("SELECT * FROM user WHERE id=:param"),
                        {"param":5}
                    )

        The second positional argument to :meth:`.Session.execute` is an
        optional parameter set.  Similar to that of
        :meth:`.Connection.execute`, whether this is passed as a single
        dictionary, or a list of dictionaries, determines whether the DBAPI
        cursor's ``execute()`` or ``executemany()`` is used to execute the
        statement.   An INSERT construct may be invoked for a single row::

            result = session.execute(
                users.insert(), {"id": 7, "name": "somename"})

        or for multiple rows::

            result = session.execute(users.insert(), [
                                    {"id": 7, "name": "somename7"},
                                    {"id": 8, "name": "somename8"},
                                    {"id": 9, "name": "somename9"}
                                ])

        The statement is executed within the current transactional context of
        this :class:`.Session`.   The :class:`.Connection` which is used
        to execute the statement can also be acquired directly by
        calling the :meth:`.Session.connection` method.  Both methods use
        a rule-based resolution scheme in order to determine the
        :class:`.Connection`, which in the average case is derived directly
        from the "bind" of the :class:`.Session` itself, and in other cases
        can be based on the :func:`.mapper`
        and :class:`.Table` objects passed to the method; see the
        documentation for :meth:`.Session.get_bind` for a full description of
        this scheme.

        The :meth:`.Session.execute` method does *not* invoke autoflush.

        The :class:`.ResultProxy` returned by the :meth:`.Session.execute`
        method is returned with the "close_with_result" flag set to true;
        the significance of this flag is that if this :class:`.Session` is
        autocommitting and does not have a transaction-dedicated
        :class:`.Connection` available, a temporary :class:`.Connection` is
        established for the statement execution, which is closed (meaning,
        returned to the connection pool) when the :class:`.ResultProxy` has
        consumed all available data. This applies *only* when the
        :class:`.Session` is configured with autocommit=True and no
        transaction has been started.

        :param clause:
            An executable statement (i.e. an :class:`.Executable` expression
            such as :func:`.expression.select`) or string SQL statement
            to be executed.

        :param params:
            Optional dictionary, or list of dictionaries, containing
            bound parameter values.   If a single dictionary, single-row
            execution occurs; if a list of dictionaries, an
            "executemany" will be invoked.  The keys in each dictionary
            must correspond to parameter names present in the statement.

        :param mapper:
          Optional :func:`.mapper` or mapped class, used to identify
          the appropriate bind.  This argument takes precedence over
          ``clause`` when locating a bind.   See :meth:`.Session.get_bind`
          for more details.

        :param bind:
          Optional :class:`.Engine` to be used as the bind.  If
          this engine is already involved in an ongoing transaction,
          that connection will be used.  This argument takes
          precedence over ``mapper`` and ``clause`` when locating
          a bind.

        :param \**kw:
          Additional keyword arguments are sent to :meth:`.Session.get_bind()`
          to allow extensibility of "bind" schemes.

        .. seealso::

            :ref:`sqlexpression_toplevel` - Tutorial on using Core SQL
            constructs.

            :ref:`connections_toplevel` - Further information on direct
            statement execution.

            :meth:`.Connection.execute` - core level statement execution
            method, which is :meth:`.Session.execute` ultimately uses
            in order to execute the statement.

        RËRÌN(Rt_literal_as_textRRKRLRjR«(R?RËtparamsRÍRORÎ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR«Ès
{c	Ks(|j|d|d|d||jƒS(s:Like :meth:`~.Session.execute` but return a scalar result.RÐRÍRO(R«R¶(R?RËRÐRÍRORÎ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR¶KscCs|jdtƒdS(s>Close this Session.

        This clears all items and ends any transaction in progress.

        If this session were created with ``autocommit=False``, a new
        transaction is immediately begun.  Note that this new transaction does
        not use any connection resources until they are first needed.

        R›N(t_close_implR¤(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR Qs
cCs|jdtƒdS(sðClose this Session, using connection invalidation.

        This is a variant of :meth:`.Session.close` that will additionally
        ensure that the :meth:`.Connection.invalidate` method will be called
        on all :class:`.Connection` objects.  This can be called when
        the database is known to be in a state where the connections are
        no longer safe to be used.

        E.g.::

            try:
                sess = Session()
                sess.add(User())
                sess.commit()
            except gevent.Timeout:
                sess.invalidate()
                raise
            except:
                sess.rollback()
                raise

        This clears all items and ends any transaction in progress.

        If this session were created with ``autocommit=False``, a new
        transaction is immediately begun.  Note that this new transaction does
        not use any connection resources until they are first needed.

        .. versionadded:: 0.9.9

        R›N(RÑRj(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR›]scCsG|jƒ|jdk	rCx'|jjƒD]}|j|ƒq)WndS(N(R¯R…RRUR (R?R›R…((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRÑ~s
cCsVx.|jjƒt|jƒD]}|jƒqW|jƒ|_i|_i|_dS(s Remove all object instances from this ``Session``.

        This is equivalent to calling ``expunge(obj)`` on all objects in this
        ``Session``.

        N(ReRkRvRVRwR¸RW(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR¯„s
#	cCsÆyt|ƒ}WnFtjk
rXt|tƒsHtjd|ƒ‚qÂ||j|<njX|jrr||j|<nP|jr¯||j|j	<x4|j
D]}||j|<q•Wntjd|ƒ‚dS(Ns!Not an acceptable bind target: %s(R
R9tNoInspectionAvailableR|R t
ArgumentErrorR»t
is_selectablet	is_mappertclass_t_all_tables(R?RcROtinspt
selectable((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRĖs		cCs|j||ƒdS(sÓAssociate a :class:`.Mapper` with a "bind", e.g. a :class:`.Engine`
        or :class:`.Connection`.

        The given mapper is added to a lookup used by the
        :meth:`.Session.get_bind` method.

        N(RÄ(R?RÍRO((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytbind_mapperªscCs|j||ƒdS(sÒAssociate a :class:`.Table` with a "bind", e.g. a :class:`.Engine`
        or :class:`.Connection`.

        The given mapper is added to a lookup used by the
        :meth:`.Session.get_bind` method.

        N(RÄ(R?ttableRO((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt
bind_table´scCsò||kodknr>|jr,|jStjdƒ‚n|dk	r˜yt|ƒ}Wq˜tjk
r”t|tƒrŽtj	|ƒ‚q•‚q˜Xn|j
r?|róx.|jjD] }||j
kr´|j
|Sq´W|dkró|j
}qón|dk	r?x:tj|dtƒD] }||j
kr|j
|SqWq?n|jrO|jSt|tjjƒrt|jrt|jS|r|j
jr|j
jSg}|dk	r¶|jd|ƒn|dk	rÒ|jdƒntjddj|ƒƒ‚dS(s<	Return a "bind" to which this :class:`.Session` is bound.

        The "bind" is usually an instance of :class:`.Engine`,
        except in the case where the :class:`.Session` has been
        explicitly bound directly to a :class:`.Connection`.

        For a multiply-bound or unbound :class:`.Session`, the
        ``mapper`` or ``clause`` arguments are used to determine the
        appropriate bind to return.

        Note that the "mapper" argument is usually present
        when :meth:`.Session.get_bind` is called via an ORM
        operation such as a :meth:`.Session.query`, each
        individual INSERT/UPDATE/DELETE operation within a
        :meth:`.Session.flush`, call, etc.

        The order of resolution is:

        1. if mapper given and session.binds is present,
           locate a bind based on mapper.
        2. if clause given and session.binds is present,
           locate a bind based on :class:`.Table` objects
           found in the given clause present in session.binds.
        3. if session.bind is present, return that.
        4. if clause given, attempt to return a bind
           linked to the :class:`.MetaData` ultimately
           associated with the clause.
        5. if mapper given, attempt to return a bind
           linked to the :class:`.MetaData` ultimately
           associated with the :class:`.Table` or other
           selectable to which the mapper is mapped.
        6. No bind can be found, :exc:`~sqlalchemy.exc.UnboundExecutionError`
           is raised.

        :param mapper:
          Optional :func:`.mapper` mapped class or instance of
          :class:`.Mapper`.   The bind can be derived from a :class:`.Mapper`
          first by consulting the "binds" map associated with this
          :class:`.Session`, and secondly by consulting the :class:`.MetaData`
          associated with the :class:`.Table` to which the :class:`.Mapper`
          is mapped for a bind.

        :param clause:
            A :class:`.ClauseElement` (i.e. :func:`~.sql.expression.select`,
            :func:`~.sql.expression.text`,
            etc.).  If the ``mapper`` argument is not present or could not
            produce a bind, the given expression construct will be searched
            for a bound element, typically a :class:`.Table` associated with
            bound :class:`.MetaData`.

        slThis session is not bound to a single Engine or Connection, and no context was provided to locate a binding.tinclude_cruds	mapper %ssSQL expressions8Could not locate a bind configured on %s or this Sessions, N(RROR9tUnboundExecutionErrorR
RÒR|R RtUnmappedClassErrorR»RÖt__mro__tmapped_tabletsql_utiltfind_tablesRjRRt
ClauseElementtappendtjoin(R?RÍRËR!R’tcontext((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRK¾sJ5	
		
cOs|j|||S(sTReturn a new :class:`.Query` object corresponding to this
        :class:`.Session`.(RÀ(R?tentitiesR'((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR%sccs$|j}t|_|V||_dS(sˆReturn a context manager that disables autoflush.

        e.g.::

            with session.no_autoflush:

                some_object = SomeClass()
                session.add(some_object)
                # won't autoflush
                some_object.related_thing = session.query(SomeRelated).first()

        Operations that proceed within the ``with:`` block
        will not be subject to flushes occurring upon query
        access.  This is useful when initializing a series
        of objects which involve existing database queries,
        where the uncompleted object should not yet be flushed.

        .. versionadded:: 0.7.6

        N(R¿R¤(R?R¿((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytno_autoflush+s		cCs[|jrW|jrWy|jƒWqWtjk
rS}|jdƒtj|ƒqWXndS(Nsraised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely(R¿RZR[R9tStatementErrort
add_detailRtraise_from_cause(R?te((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt
_autoflushGsc	Cs¥ytj|ƒ}Wn#tjk
r8tj|ƒ‚nX|j||ƒtj|jt	|ƒƒ|j
d|d|d|ƒdkr¡tj
dt|ƒƒ‚ndS(sXExpire and refresh the attributes on the given instance.

        A query will be issued to the database and all attributes will be
        refreshed with their current database value.

        Lazy-loaded relational attributes will remain lazily loaded, so that
        the instance-wide refresh operation will be followed immediately by
        the lazy load of that attribute.

        Eagerly-loaded relational attributes will eagerly load within the
        single refresh operation.

        Note that a highly isolated transaction will return the same values as
        were previously read in that same transaction, regardless of changes
        in database state outside of that transaction - usage of
        :meth:`~Session.refresh` usually only makes sense if non-ORM SQL
        statement were emitted in the ongoing transaction, or if autocommit
        mode is turned on.

        :param attribute_names: optional.  An iterable collection of
          string attribute names indicating a subset of attributes to
          be refreshed.

        :param lockmode: Passed to the :class:`~sqlalchemy.orm.query.Query`
          as used by :meth:`~sqlalchemy.orm.query.Query.with_lockmode`.

        .. seealso::

            :ref:`session_expire` - introductory material

            :meth:`.Session.expire`

            :meth:`.Session.expire_all`

        t
refresh_statetlockmodetonly_load_propssCould not refresh instance '%s'N(Rtinstance_stateRtNO_STATEtUnmappedInstanceErrort
_expire_stateRt
load_on_identRRRcRR9R:R(R?R)tattribute_namesRðR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRµVs$cCs7x0|jjƒD]}|j|j|jjƒqWdS(s´Expires all persistent instances within this Session.

        When any attributes on a persistent instance is next accessed,
        a query will be issued using the
        :class:`.Session` object's current transactional context in order to
        load all expired attributes for the given instance.   Note that
        a highly isolated transaction will return the same values as were
        previously read in that same transaction, regardless of changes
        in database state outside of that transaction.

        To expire individual objects and individual attributes
        on those objects, use :meth:`Session.expire`.

        The :class:`.Session` object's default behavior is to
        expire all state whenever the :meth:`Session.rollback`
        or :meth:`Session.commit` methods are called, so that new
        state can be loaded for the new transaction.   For this reason,
        calling :meth:`Session.expire_all` should not be needed when
        autocommit is ``False``, assuming the transaction is isolated.

        .. seealso::

            :ref:`session_expire` - introductory material

            :meth:`.Session.expire`

            :meth:`.Session.refresh`

        N(ReRkRmRnRo(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR­ŠscCsMytj|ƒ}Wn#tjk
r8tj|ƒ‚nX|j||ƒdS(sŽExpire the attributes on an instance.

        Marks the attributes of an instance as out of date. When an expired
        attribute is next accessed, a query will be issued to the
        :class:`.Session` object's current transactional context in order to
        load all expired attributes for the given instance.   Note that
        a highly isolated transaction will return the same values as were
        previously read in that same transaction, regardless of changes
        in database state outside of that transaction.

        To expire all objects in the :class:`.Session` simultaneously,
        use :meth:`Session.expire_all`.

        The :class:`.Session` object's default behavior is to
        expire all state whenever the :meth:`Session.rollback`
        or :meth:`Session.commit` methods are called, so that new
        state can be loaded for the new transaction.   For this reason,
        calling :meth:`Session.expire` only makes sense for the specific
        case that a non-ORM SQL statement was emitted in the current
        transaction.

        :param instance: The instance to be refreshed.
        :param attribute_names: optional list of string attribute names
          indicating a subset of attributes to be expired.

        .. seealso::

            :ref:`session_expire` - introductory material

            :meth:`.Session.expire`

            :meth:`.Session.refresh`

        N(RRòRRóRôRõ(R?R)R÷R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR¬«s
#cCs‚|j|ƒ|r)|j|j|ƒnUt|jjjd|ƒƒ}|j|ƒx'|D]\}}}}|j|ƒq[WdS(Nsrefresh-expire(t_validate_persistentt_expire_attributesRnRvtmanagerRÍtcascade_iteratort_conditional_expire(R?RR÷tcascadedtotmtst_tdct_((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRõÔs

cCsU|jr%|j|j|jjƒn,||jkrQ|jj|ƒ|jƒndS(s5Expire a state if persistent, else expunge if pendingN(RcRmRnReRoRVtpopRw(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRüás
	s0.7sBThe non-weak-referencing identity map feature is no longer needed.cCs
|jjƒS(s”Remove unreferenced instances cached in the identity map.

        Note that this method is only meaningful if "weak_identity_map" is set
        to False.  The default weak identity map is self-pruning.

        Removes any object in this Session's identity map that is not
        referenced in user code, modified, new or scheduled for deletion.
        Returns the number of objects pruned.

        (Retprune(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRês
cCsÀytj|ƒ}Wn#tjk
r8tj|ƒ‚nX|j|jk	rgtjdt	|ƒƒ‚nt
|jjj
d|ƒƒ}|j|ƒx'|D]\}}}}|j|ƒq™WdS(sÃRemove the `instance` from this ``Session``.

        This will free all internal references to the instance.  Cascading
        will be applied according to the *expunge* cascade rule.

        s*Instance %s is not present in this SessionR®N(RRòRRóRôRR¾R9R:RRvRúRÍRûRb(R?R)RRýRþRÿRR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR®ùs
cCsž||jkr,|jj|ƒ|jƒnn|jj|ƒrn|jj|ƒ|jj|dƒ|jƒn,|jrš|jjj|dƒ|jƒndS(N(	RVRRwRetcontains_stateRfRWRR…(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRbs

	cCs•x.|D]&}t|ƒ}|jƒ}|dk	r|j|ƒ}tj|dƒr]|jsptj|dƒrŒtj	dt
|ƒƒ‚n|jdkr§||_ns|j|kr|jj
|ƒ||jjkrï|jj|d}n	|j}||f|jj|<||_n|jj|ƒqqWtjjd„|Dƒ|jƒ|j|ƒx0t|ƒj|jƒD]}|jj|ƒqwWdS(NisNInstance %s has a NULL identity key.  If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values.  Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event.icss|]}||jfVqdS(N(Rn(t.0R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pys	<genexpr>Es(RtobjRt_identity_key_from_stateRtintersectiontallow_partial_pkst
issupersetRRŒRRcReRfR…RYRgtstatelibt
InstanceStatet_commit_all_statest_register_alteredR`RVR(R?tstatesRRÍRtinstance_keytorig_key((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_register_newly_persistents6

		


cCs\|jrX|jrXxC|D]8}||jkrAt|jj|<qt|jj|<qWndS(N(R;R…RVRjRX(R?RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRNs

cCsfx_|D]W}|jr2|jr2t|jj|<n|jj|ƒ|jj|dƒt|_qWdS(N(	R;R…RjRWReRfRRRh(R?RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt_remove_newly_deletedVs
cCsi|r|jr|jdƒnytj|ƒ}Wn#tjk
rWtj|ƒ‚nX|j|ƒdS(sñPlace an object in the ``Session``.

        Its state will be persisted to the database on the next flush
        operation.

        Repeated calls to ``add()`` will be ignored. The opposite of ``add()``
        is ``expunge()``.

        s
Session.add()N(R¼t_flush_warningRRòRRóRôt_save_or_update_state(R?R)t_warnR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR¨_s
cCsA|jr|jdƒnx!|D]}|j|dtƒq WdS(s:Add the given collection of instances to this ``Session``.sSession.add_all()RN(R¼RR¨R¤(R?t	instancesR)((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR©ss	
cCs\|j|ƒt|ƒ}x<|jd|d|jƒD]\}}}}|j|ƒq5WdS(Nssave-updatethalt_on(t_save_or_update_implRRût_contains_state(R?RRÍRþRÿRR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR|s
	cCs|jr|jdƒnytj|ƒ}Wn#tjk
rQtj|ƒ‚nX|jdkr}t	j
dt|ƒƒ‚n||jkrdS|j
|dtƒt|jjjd|ƒƒ}|jƒ|j|<|jj|ƒx'|D]\}}}}|j|ƒqëWdS(sfMark an instance as deleted.

        The database delete operation occurs upon ``flush()``.

        sSession.delete()sInstance '%s' is not persistedNtinclude_beforeRª(R¼RRRòRRóRôRcRR9R:RRWt_attachRjRvRúRÍRûRReR¨t_delete_impl(R?R)Rtcascade_statesRþRÿRR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRª†s&	cCs‘|jr|jdƒni}|r2|jƒnt|ƒ|j}z;t|_|jtj|ƒtj	|ƒd|d|ƒSWd||_XdS(sS	Copy the state of a given instance into a corresponding instance
        within this :class:`.Session`.

        :meth:`.Session.merge` examines the primary key attributes of the
        source instance, and attempts to reconcile it with an instance of the
        same primary key in the session.   If not found locally, it attempts
        to load the object from the database based on primary key, and if
        none can be located, creates a new instance.  The state of each
        attribute on the source instance is then copied to the target
        instance.  The resulting target instance is then returned by the
        method; the original source instance is left unmodified, and
        un-associated with the :class:`.Session` if not already.

        This operation cascades to associated instances if the association is
        mapped with ``cascade="merge"``.

        See :ref:`unitofwork_merging` for a detailed discussion of merging.

        :param instance: Instance to be merged.
        :param load: Boolean, when False, :meth:`.merge` switches into
         a "high performance" mode which causes it to forego emitting history
         events as well as all database access.  This flag is used for
         cases such as transferring graphs of objects into a :class:`.Session`
         from a second level cache, or to transfer just-loaded objects
         into the :class:`.Session` owned by a worker thread or process
         without re-querying the database.

         The ``load=False`` use case adds the caveat that the given
         object has to be in a "clean" state, that is, has no pending changes
         to be flushed - even if the incoming object is detached from any
         :class:`.Session`.   This is so that when
         the merge operation populates local attributes and
         cascades to related objects and
         collections, the values can be "stamped" onto the
         target object as is, without generating any history or attribute
         events, and without the need to reconcile the incoming data with
         any existing related objects or collections that might not
         be loaded.  The resulting objects from ``load=False`` are always
         produced as "clean", so it is only appropriate that the given objects
         should be "clean" as well, else this suggests a mis-use of the
         method.

        sSession.merge()tloadt
_recursiveN(
R¼RRîRR¿R¤t_mergeRRòt
instance_dict(R?R)RR R¿((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR´­s-	

		cCs
t|ƒ}||kr ||St}|j}|dkrx|sStjdƒ‚n|j|ƒ}tj|dk}nt	}||j
kr|j
|}	n½|sû|jr¾tjdƒ‚n|jj
ƒ}	tj|	ƒ}
||
_|j|
ƒt	}n_|rTtj|dƒs2|jrTtj|dƒrT|j|jƒj|dƒ}	nd}	|	dkr©|jj
ƒ}	tj|	ƒ}
tj|	ƒ}t	}|j|
ƒntj|	ƒ}
tj|	ƒ}|	||<||
k	rÎ|jdk	r€|j|||jdtjƒ}|j|
||jdtjƒ}
|tjk	r€|
tjk	r€||
kr€tjd|t|
ƒ|
fƒ‚q€n|j |
_ |j!|
_!x3|j"D]%}|j#||||
|||ƒq¢Wn|sê|
j$||j
ƒn|r	|
j%j&j'|
dƒn|	S(Ns¦merge() with load=False option does not support objects transient (i.e. unpersisted) objects.  flush() all changes on mapped instances before merging with load=False.is“merge() with load=False option does not support objects marked as 'dirty'.  flush() all changes on mapped instances before merging with load=False.tpassivesšVersion id '%s' on merged state %s does not match existing version '%s'. Leave the version attribute unset when merging to update the most recent version.((RR¤RcRR9R:RRt	NEVER_SETRjReRlt
class_managertnew_instanceRòRiRRR	R
RRÖtgetR"Rtversion_id_colt_get_state_attr_by_columntPASSIVE_NO_INITIALIZEtPASSIVE_NO_RESULTRtStaleDataErrorRt	load_pathtload_optionstiterate_propertiesR´t_commit_allRúR=R(R?Rt
state_dictRR RÍR&Rctkey_is_persistenttmergedtmerged_statetmerged_dicttexisting_versiontmerged_versiontprop((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR!îsŠ			
		"
			cCs2|jj|ƒs.tjdt|ƒƒ‚ndS(Ns3Instance '%s' is not persistent within this Session(ReRR9R:R(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRøTscCs€|jdk	r+tjdt|ƒƒ‚n|j|ƒ||jkro|jƒ|j|<t|jƒ|_	n|j
|ƒdS(NsGObject '%s' already has an identity - it can't be registered as pending(RcRR9R:Rt_before_attachRVRtlentinsert_orderR(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt
_save_implZs
cCsÕ|jj|ƒr%||jkr%dS|jdkrPtjdt|ƒƒ‚n|jrutjdt|ƒƒ‚n|j	|dt
ƒ|jj|dƒ|r´|jj|ƒn|jj
|ƒ|j|ƒdS(NsInstance '%s' is not persistedssInstance '%s' has been deleted.  Use the make_transient() function to send this object back to the transient state.tcheck_identity_map(ReRRWRcRR9R:RRhR9R¤RRgR¨R(R?RR^((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRifs"	cCs0|jdkr|j|ƒn
|j|ƒdS(N(RcRR<Ri(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR~scCs`||jkrdS|jdkr&dS|j|dtƒ|jƒ|j|<|jj|ƒdS(NR(RWRcRRRjRReR¨(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR„scCs/tj|ƒ}|j|dtƒt|_dS(sÖAssociate an object with this :class:`.Session` for related
        object loading.

        .. warning::

            :meth:`.enable_relationship_loading` exists to serve special
            use cases and is not recommended for general use.

        Accesses of attributes mapped with :func:`.relationship`
        will attempt to load a value from the database using this
        :class:`.Session` as the source of connectivity.  The values
        will be loaded based on foreign key values present on this
        object - it follows that this functionality
        generally only works for many-to-one-relationships.

        The object will be attached to this session, but will
        **not** participate in any persistence operations; its state
        for almost all purposes will remain either "transient" or
        "detached", except for the case of relationship loading.

        Also note that backrefs will often not work as expected.
        Altering a relationship-bound attribute on the target object
        may not fire off a backref event, if the effective value
        is what was already loaded from a foreign-key-holding value.

        The :meth:`.Session.enable_relationship_loading` method is
        similar to the ``load_on_pending`` flag on :func:`.relationship`.
        Unlike that flag, :meth:`.Session.enable_relationship_loading` allows
        an object to remain transient while still being able to load
        related items.

        To make a transient object associated with a :class:`.Session`
        via :meth:`.Session.enable_relationship_loading` pending, add
        it to the :class:`.Session` using :meth:`.Session.add` normally.

        :meth:`.Session.enable_relationship_loading` does not improve
        behavior when the ORM is used normally - object references should be
        constructed at the object level, not at the foreign key level, so
        that they are present in an ordinary way before flush()
        proceeds.  This method is not intended for general use.

        .. versionadded:: 0.8

        .. seealso::

            ``load_on_pending`` at :func:`.relationship` - this flag
            allows per-relationship loading of many-to-ones on items that
            are pending.

        RN(RRòRRjt
_load_pending(R?RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytenable_relationship_loadings3cCsì|j|jkr:|jjr:|jj||jƒƒn|r“|jr“|j|jkr“|jj|ƒr“tj	dt
|ƒ|jfƒ‚n|jrè|j|jk	rè|jtkrètj	dt
|ƒ|j|jfƒ‚ndS(NsZCan't attach instance %s; another instance with key %s is already present in this session.s>Object '%s' is already attached to session '%s' (this is '%s')(RR¾R=t
before_attachRRcReRR9R:RR(R?RR=((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR9Æs 		cCs|j|jkr‰|r(|j|ƒn|j|_|jr^|jdkr^|jƒ|_n|jjr‰|jj||jƒƒq‰ndS(N(	RR¾R9Rlt_strong_objRRR=tafter_attach(R?RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRÛscCsFytj|ƒ}Wn#tjk
r8tj|ƒ‚nX|j|ƒS(sªReturn True if the instance is associated with this session.

        The instance may be pending or persistent within the Session for a
        result of True.

        (RRòRRóRôR(R?R)R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR¦æs
cCs,tt|jjƒƒt|jjƒƒƒS(sWIterate over all pending or persistent instances within this
        Session.

        (titerRvRVRRe(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR§óscCs||jkp|jj|ƒS(N(RVReR(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRûscCsV|jrtjdƒ‚n|jƒr+dSzt|_|j|ƒWdt|_XdS(s®Flush all the object changes to the database.

        Writes out all pending object creations, deletions and modifications
        to the database as INSERTs, DELETEs, UPDATEs, etc.  Operations are
        automatically ordered by the Session's unit of work dependency
        solver.

        Database operations will be issued in the current transactional
        context and do not affect the state of the transaction, unless an
        error occurs, in which case the entire transaction is rolled back.
        You may flush() as often as you like within a transaction to move
        changes from Python to the database's transaction buffer.

        For ``autocommit`` Sessions with no active manual transaction, flush()
        will create a transaction on the fly that surrounds the entire set of
        operations into the flush.

        :param objects: Optional; restricts the flush operation to operate
          only on elements that are in the given collection.

          This feature is for an extremely narrow set of use cases where
          particular objects may need to be operated upon before the
          full flush() occurs.  It is not intended for general use.

        sSession is already flushingN(RZR9R:R‹Rjt_flushR¤(R?tobjects((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR[þs		cCstjd|ƒdS(NsÚUsage of the '%s' operation is not currently supported within the execution stage of the flush process. Results may not be consistent.  Consider using alternative event listeners or connection-level operations instead.(RR{(R?tmethod((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR$scCs"|jjƒo!|jo!|jS(N(Retcheck_modifiedRWRV(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR‹,s
c	Cs/|j}|r8|jr8|jr8|jjjƒdSt|ƒ}|jjrr|jj|||ƒ|j}nt	|jƒ}t	|jƒ}t	|ƒj
|ƒ}|rt	ƒ}x]|D]L}ytj|ƒ}Wn#t
jk
rùt
j|ƒ‚nX|j|ƒq»Wnd}t	ƒ}	|rG|j|ƒj|ƒj
|ƒ}
n|j|ƒj
|ƒ}
xL|
D]D}t|ƒj|ƒo‡|j}|j|d|ƒ|	j|ƒqfW|rÏ|j|ƒj
|	ƒ}
n|j
|	ƒ}
x!|
D]}|j|dtƒqåW|jsdS|jdtƒ|_}yÖt|_z|jƒWdt|_X|jj||ƒ|j ƒ|rà|jjràt!|jjƒ}
t"j#j$g|jjD]}||j%f^q§d|jƒt&j'd|
ƒn|jj(||ƒ|j)ƒWn*t&j*ƒ|j+dtƒWdQXnXdS(NtisdeleteRÊR"sÿAttribute history events accumulated on %d previously clean instances within inner-flush event handlers have been reset, and will not result in database updates. Consider using set_committed_value() within inner-flush event handlers to avoid this warning.R˜(,t
_dirty_statesRWRVReRoRxRR=tbefore_flushR`t
differenceRRòRRóRôR¨RRaRRt
_is_orphanthas_identitytregister_objectRjthas_workR‚R…R¼R«R¤tafter_flushtfinalize_flush_changesR:RRR
RnRR{tafter_flush_postexecR‰RRŽ(R?REtdirtyt
flush_contextRhtnewtobjsetRþRt	processedtproct	is_orphanR…tlen_((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRD1sr		
	$

			

	%
		
cCsVxOtjd„|Dƒd„ƒD].\\}}}|j|||t||ƒq WdS(sž
Perform a bulk save of the given list of objects.

        The bulk save feature allows mapped objects to be used as the
        source of simple INSERT and UPDATE operations which can be more easily
        grouped together into higher performing "executemany"
        operations; the extraction of data from the objects is also performed
        using a lower-latency process that ignores whether or not attributes
        have actually been modified in the case of UPDATEs, and also ignores
        SQL expressions.

        The objects as given are not added to the session and no additional
        state is established on them, unless the ``return_defaults`` flag
        is also set, in which case primary key attributes and server-side
        default values will be populated.

        .. versionadded:: 1.0.0

        .. warning::

            The bulk save feature allows for a lower-latency INSERT/UPDATE
            of rows at the expense of most other unit-of-work features.
            Features such as object management, relationship handling,
            and SQL clause support are **silently omitted** in favor of raw
            INSERT/UPDATES of records.

            **Please read the list of caveats at** :ref:`bulk_operations`
            **before using this method, and fully test and confirm the
            functionality of all code developed using these systems.**

        :param objects: a list of mapped object instances.  The mapped
         objects are persisted as is, and are **not** associated with the
         :class:`.Session` afterwards.

         For each object, whether the object is sent as an INSERT or an
         UPDATE is dependent on the same rules used by the :class:`.Session`
         in traditional operation; if the object has the
         :attr:`.InstanceState.key`
         attribute set, then the object is assumed to be "detached" and
         will result in an UPDATE.  Otherwise, an INSERT is used.

         In the case of an UPDATE, statements are grouped based on which
         attributes have changed, and are thus to be the subject of each
         SET clause.  If ``update_changed_only`` is False, then all
         attributes present within each object are applied to the UPDATE
         statement, which may help in allowing the statements to be grouped
         together into a larger executemany(), and will also reduce the
         overhead of checking history on attributes.

        :param return_defaults: when True, rows that are missing values which
         generate defaults, namely integer primary key defaults and sequences,
         will be inserted **one at a time**, so that the primary key value
         is available.  In particular this will allow joined-inheritance
         and other multi-table mappings to insert correctly without the need
         to provide primary key values ahead of time; however,
         :paramref:`.Session.bulk_save_objects.return_defaults` **greatly
         reduces the performance gains** of the method overall.

        :param update_changed_only: when True, UPDATE statements are rendered
         based on those attributes in each state that have logged changes.
         When False, all attributes present are rendered into the SET clause
         with the exception of primary key attributes.

        .. seealso::

            :ref:`bulk_operations`

            :meth:`.Session.bulk_insert_mappings`

            :meth:`.Session.bulk_update_mappings`

        css|]}tj|ƒVqdS(N(RRò(RR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pys	<genexpr>âscSs|j|jdk	fS(N(RÍRcR(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt<lambda>ãsN(t	itertoolstgroupbyt_bulk_save_mappingsRj(R?REtreturn_defaultstupdate_changed_onlyRÍtisupdateR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR±˜sI	
cCs |j||tt|tƒdS(sè
Perform a bulk insert of the given list of mapping dictionaries.

        The bulk insert feature allows plain Python dictionaries to be used as
        the source of simple INSERT operations which can be more easily
        grouped together into higher performing "executemany"
        operations.  Using dictionaries, there is no "history" or session
        state management features in use, reducing latency when inserting
        large numbers of simple rows.

        The values within the dictionaries as given are typically passed
        without modification into Core :meth:`.Insert` constructs, after
        organizing the values within them across the tables to which
        the given mapper is mapped.

        .. versionadded:: 1.0.0

        .. warning::

            The bulk insert feature allows for a lower-latency INSERT
            of rows at the expense of most other unit-of-work features.
            Features such as object management, relationship handling,
            and SQL clause support are **silently omitted** in favor of raw
            INSERT of records.

            **Please read the list of caveats at** :ref:`bulk_operations`
            **before using this method, and fully test and confirm the
            functionality of all code developed using these systems.**

        :param mapper: a mapped class, or the actual :class:`.Mapper` object,
         representing the single kind of object represented within the mapping
         list.

        :param mappings: a list of dictionaries, each one containing the state
         of the mapped row to be inserted, in terms of the attribute names
         on the mapped class.   If the mapping refers to multiple tables,
         such as a joined-inheritance mapping, each dictionary must contain
         all keys to be populated into all tables.

        :param return_defaults: when True, rows that are missing values which
         generate defaults, namely integer primary key defaults and sequences,
         will be inserted **one at a time**, so that the primary key value
         is available.  In particular this will allow joined-inheritance
         and other multi-table mappings to insert correctly without the need
         to provide primary
         key values ahead of time; however,
         :paramref:`.Session.bulk_insert_mappings.return_defaults`
         **greatly reduces the performance gains** of the method overall.
         If the rows
         to be inserted only refer to a single table, then there is no
         reason this flag should be set as the returned default information
         is not used.


        .. seealso::

            :ref:`bulk_operations`

            :meth:`.Session.bulk_save_objects`

            :meth:`.Session.bulk_update_mappings`

        N(R^R¤(R?RÍtmappingsR_((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR²és?cCs |j||ttttƒdS(s¶Perform a bulk update of the given list of mapping dictionaries.

        The bulk update feature allows plain Python dictionaries to be used as
        the source of simple UPDATE operations which can be more easily
        grouped together into higher performing "executemany"
        operations.  Using dictionaries, there is no "history" or session
        state management features in use, reducing latency when updating
        large numbers of simple rows.

        .. versionadded:: 1.0.0

        .. warning::

            The bulk update feature allows for a lower-latency UPDATE
            of rows at the expense of most other unit-of-work features.
            Features such as object management, relationship handling,
            and SQL clause support are **silently omitted** in favor of raw
            UPDATES of records.

            **Please read the list of caveats at** :ref:`bulk_operations`
            **before using this method, and fully test and confirm the
            functionality of all code developed using these systems.**

        :param mapper: a mapped class, or the actual :class:`.Mapper` object,
         representing the single kind of object represented within the mapping
         list.

        :param mappings: a list of dictionaries, each one containing the state
         of the mapped row to be updated, in terms of the attribute names
         on the mapped class.   If the mapping refers to multiple tables,
         such as a joined-inheritance mapping, each dictionary may contain
         keys corresponding to all tables.   All those keys which are present
         and are not part of the primary key are applied to the SET clause
         of the UPDATE statement; the primary key values, which are required,
         are applied to the WHERE clause.


        .. seealso::

            :ref:`bulk_operations`

            :meth:`.Session.bulk_insert_mappings`

            :meth:`.Session.bulk_save_objects`

        N(R^RjR¤(R?RÍRb((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR³+	s/cCs²t|ƒ}t|_|jdtƒ}zzyI|rOtj|||||ƒntj|||||ƒ|jƒWn*tj	ƒ|j
dtƒWdQXnXWdt|_XdS(NRÊR˜(R
RjRZR‚Rt_bulk_updatet_bulk_insertR‰RRRŽR¤(R?RÍRbRatisstatesR_R`R…((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR^\	s"				

c
Csªt|ƒ}|jstS|j}x|jjD]o}|rNt|jdƒs/t|jdƒrgq/n|jj||dtj	ƒ\}}}	|sš|	r/t
Sq/WtSdS(sÂReturn ``True`` if the given instance has locally
        modified attributes.

        This method retrieves the history for each instrumented
        attribute on the instance and performs a comparison of the current
        value to its previously committed value, if any.

        It is in effect a more expensive and accurate
        version of checking for the given instance in the
        :attr:`.Session.dirty` collection; a full test for
        each attribute's net "dirty" status is performed.

        E.g.::

            return session.is_modified(someobject)

        .. versionchanged:: 0.8
            When using SQLAlchemy 0.7 and earlier, the ``passive``
            flag should **always** be explicitly set to ``True``,
            else SQL loads/autoflushes may proceed which can affect
            the modified state itself:
            ``session.is_modified(someobject, passive=True)``\ .
            In 0.8 and above, the behavior is corrected and
            this flag is ignored.

        A few caveats to this method apply:

        * Instances present in the :attr:`.Session.dirty` collection may
          report ``False`` when tested with this method.  This is because
          the object may have received change events via attribute mutation,
          thus placing it in :attr:`.Session.dirty`, but ultimately the state
          is the same as that loaded from the database, resulting in no net
          change here.
        * Scalar attributes may not have recorded the previously set
          value when a new value was applied, if the attribute was not loaded,
          or was expired, at the time the new value was received - in these
          cases, the attribute is assumed to have a change, even if there is
          ultimately no net change against its database value. SQLAlchemy in
          most cases does not need the "old" value when a set event occurs, so
          it skips the expense of a SQL call if the old value isn't present,
          based on the assumption that an UPDATE of the scalar value is
          usually needed, and in those few cases where it isn't, is less
          expensive on average than issuing a defensive SELECT.

          The "old" value is fetched unconditionally upon set only if the
          attribute container has the ``active_history`` flag set to ``True``.
          This flag is set typically for primary key attributes and scalar
          object references that are not a simple many-to-one.  To set this
          flag for any arbitrary mapped column, use the ``active_history``
          argument with :func:`.column_property`.

        :param instance: mapped instance to be tested for pending changes.
        :param include_collections: Indicates if multivalued collections
         should be included in the operation.  Setting this to ``False`` is a
         way to detect only local-column based properties (i.e. scalar columns
         or many-to-one foreign keys) that would result in an UPDATE for this
         instance upon flush.
        :param passive:

         .. versionchanged:: 0.8
             Ignored for backwards compatibility.
             When using SQLAlchemy 0.7 and earlier, this flag should always
             be set to ``True``.

        tget_collectiontget_historyR#N(RRlR¤RnRúRthasattrtimplRgt	NO_CHANGERj(
R?R)tinclude_collectionsR#Rtdict_tattrtaddedt	unchangedRh((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR°t	sC		cCs|jo|jjS(s+True if this :class:`.Session` is in "transaction mode" and
        is not in "partial rollback" state.

        The :class:`.Session` in its default mode of ``autocommit=False``
        is essentially always in "transaction mode", in that a
        :class:`.SessionTransaction` is associated with it as soon as
        it is instantiated.  This :class:`.SessionTransaction` is immediately
        replaced with a new one as soon as it is ended, due to a rollback,
        commit, or close operation.

        "Transaction mode" does *not* indicate whether
        or not actual database connection resources are in use;  the
        :class:`.SessionTransaction` object coordinates among zero or more
        actual database transactions, and starts out with none, accumulating
        individual DBAPI connections as different data sources are used
        within its scope.   The best way to track when a particular
        :class:`.Session` has actually begun to use DBAPI resources is to
        implement a listener using the :meth:`.SessionEvents.after_begin`
        method, which will deliver both the :class:`.Session` as well as the
        target :class:`.Connection` to a user-defined event listener.

        The "partial rollback" state refers to when an "inner" transaction,
        typically used during a flush, encounters an error and emits a
        rollback of the DBAPI connection.  At this point, the
        :class:`.Session` is in "partial rollback" and awaits for the user to
        call :meth:`.Session.rollback`, in order to close out the
        transaction stack.  It is in this "partial rollback" period that the
        :attr:`.is_active` flag returns False.  After the call to
        :meth:`.Session.rollback`, the :class:`.SessionTransaction` is
        replaced with a new one and :attr:`.is_active` returns ``True`` again.

        When a :class:`.Session` is used in ``autocommit=True`` mode, the
        :class:`.SessionTransaction` is only instantiated within the scope
        of a flush call, or when :meth:`.Session.begin` is called.  So
        :attr:`.is_active` will always be ``False`` outside of a flush or
        :meth:`.Session.begin` block in this mode, and will be ``True``
        within the :meth:`.Session.begin` block as long as it doesn't enter
        "partial rollback" state.

        From all the above, it follows that the only purpose to this flag is
        for application frameworks that wish to detect is a "rollback" is
        necessary within a generic error handling routine, for
        :class:`.Session` objects that would otherwise be in
        "partial rollback" mode.  In a typical integration case, this is also
        not necessary as it is standard practice to emit
        :meth:`.Session.rollback` unconditionally within the outermost
        exception catch.

        To track the transactional state of a :class:`.Session` fully,
        use event listeners, primarily the :meth:`.SessionEvents.after_begin`,
        :meth:`.SessionEvents.after_commit`,
        :meth:`.SessionEvents.after_rollback` and related events.

        (R…RB(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRBÏ	s8cCs
|jjƒS(s«The set of all persistent states considered dirty.

        This method returns all states that were modified including
        those that were possibly deleted.

        (ReRI(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRI
scCs8tjg|jD]!}||jkr|jƒ^qƒS(sZThe set of all persistent instances considered dirty.

        E.g.::

            some_mapped_object in session.dirty

        Instances are considered dirty when they were modified but not
        deleted.

        Note that this 'dirty' calculation is 'optimistic'; most
        attribute-setting or collection modification operations will
        mark an instance as 'dirty' and place it in this set, even if
        there is no net change to the attribute's value.  At flush
        time, the value of each attribute is compared to its
        previously saved value, and if there's no net change, no SQL
        operation will occur (this is a more expensive operation so
        it's only done at flush time).

        To check if an instance has actionable net changes to its
        attributes, use the :meth:`.Session.is_modified` method.

        (RtIdentitySetRIRWR(R?R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRS!
s
cCstjt|jjƒƒƒS(sDThe set of all instances marked as 'deleted' within this ``Session``(RRpRvRWR(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRh>
scCstjt|jjƒƒƒS(sAThe set of all instances marked as 'new' within this ``Session``.(RRpRvRVR(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRUD
s(s__contains__s__iter__saddsadd_allsbeginsbegin_nestedsclosescommits
connectionsdeletesexecutesexpires
expire_allsexpungesexpunge_allsflushsget_bindsis_modifiedsbulk_save_objectssbulk_insert_mappingssbulk_update_mappingssmergesquerysrefreshsrollbacksscalarN(PR*R+R,tpublic_methodsRRjR¤RtQueryRAtconnection_callableR…Rtmemoized_propertyRÁR‚RRŽR‰R‡RPRLR«R¶R R›RÑR¯RÄRÚRÜRKR¥tcontextmanagerRéRîRµR­R¬RõRüt
deprecatedRR®RbRRRR¨R©RRªR´R!RøR<RiRRR?R9RR¦R§RR[RR‹RDR±R²R³R^R°RBReRIRSRhRU(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR.sª		¨			$	F
ƒ		!				
	
g		4	!)	
					3						
	'Af					7	
		&		hPB	1	Z:
cBsDeZdZdeeeedd„Zd„Zd„Z	d„Z
RS(s'A configurable :class:`.Session` factory.

    The :class:`.sessionmaker` factory generates new
    :class:`.Session` objects when called, creating them given
    the configurational arguments established here.

    e.g.::

        # global scope
        Session = sessionmaker(autoflush=False)

        # later, in a local scope, create and use a session:
        sess = Session()

    Any keyword arguments sent to the constructor itself will override the
    "configured" keywords::

        Session = sessionmaker()

        # bind an individual session to a connection
        sess = Session(bind=connection)

    The class also includes a method :meth:`.configure`, which can
    be used to specify additional keyword arguments to the factory, which
    will take effect for subsequent :class:`.Session` objects generated.
    This is usually used to associate one or more :class:`.Engine` objects
    with an existing :class:`.sessionmaker` factory before it is first
    used::

        # application starts
        Session = sessionmaker()

        # ... later
        engine = create_engine('sqlite:///foo.db')
        Session.configure(bind=engine)

        sess = Session()

    .. seealso:

        :ref:`session_getting` - introductory text on creating
        sessions using :class:`.sessionmaker`.

    cKsi||d<||d<||d<||d<|dk	rA||d<n||_t|j|fiƒ|_dS(s8Construct a new :class:`.sessionmaker`.

        All arguments here except for ``class_`` correspond to arguments
        accepted by :class:`.Session` directly.  See the
        :meth:`.Session.__init__` docstring for more details on parameters.

        :param bind: a :class:`.Engine` or other :class:`.Connectable` with
         which newly created :class:`.Session` objects will be associated.
        :param class_: class to use in order to create new :class:`.Session`
         objects.  Defaults to :class:`.Session`.
        :param autoflush: The autoflush setting to use with newly created
         :class:`.Session` objects.
        :param autocommit: The autocommit setting to use with newly created
         :class:`.Session` objects.
        :param expire_on_commit=True: the expire_on_commit setting to use
         with newly created :class:`.Session` objects.
        :param info: optional dictionary of information that will be available
         via :attr:`.Session.info`.  Note this dictionary is *updated*, not
         replaced, when the ``info`` parameter is specified to the specific
         :class:`.Session` construction operation.

         .. versionadded:: 0.9.0

        :param \**kw: all other keyword arguments are passed to the
         constructor of newly created :class:`.Session` objects.

        ROR¿RRuRÁN(RRÎR R*RÖ(R?RORÖR¿RRuRÁRÎ((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRAy
s




	cKsxo|jjƒD]^\}}|dkr^d|kr^|jƒ}|j|dƒ||d<q|j||ƒqW|j|S(seProduce a new :class:`.Session` object using the configuration
        established in this :class:`.sessionmaker`.

        In Python, the ``__call__`` method is invoked on an object when
        it is "called" in the same way as a function::

            Session = sessionmaker()
            session = Session()  # invokes sessionmaker.__call__()

        RÁ(RÎRdtcopyRyt
setdefaultRÖ(R?tlocal_kwtktvtd((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt__call__£
s
cKs|jj|ƒdS(s±(Re)configure the arguments for this sessionmaker.

        e.g.::

            Session = sessionmaker()

            Session.configure(bind=create_engine('sqlite://'))
        N(RÎRy(R?tnew_kw((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt	configure·
s	cCs9d|jj|jjdjd„|jjƒDƒƒfS(Ns%s(class_=%r,%s)s, css%|]\}}d||fVqdS(s%s=%rN((RRzR{((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pys	<genexpr>Æ
s(t	__class__R*RÖRæRÎRd(R?((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt__repr__Â
s		N(R*R+R,RRRjR¤RAR}RR(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyRK
s,	'		cCsxtj|ƒ}t|ƒ}|r1|j|ƒn|jjƒ|jrP|`n|jrb|`n|jrt|`ndS(sMAlter the state of the given instance so that it is :term:`transient`.

    .. note::

        :func:`.make_transient` is a special-case function for
        advanced use cases only.

    The given mapped instance is assumed to be in the :term:`persistent` or
    :term:`detached` state.   The function will remove its association with any
    :class:`.Session` as well as its :attr:`.InstanceState.identity`. The
    effect is that the object will behave as though it were newly constructed,
    except retaining any attribute / collection values that were loaded at the
    time of the call.   The :attr:`.InstanceState.deleted` flag is also reset
    if this object had been deleted as a result of using
    :meth:`.Session.delete`.

    .. warning::

        :func:`.make_transient` does **not** "unexpire" or otherwise eagerly
        load ORM-mapped attributes that are not currently loaded at the time
        the function is called.   This includes attributes which:

        * were expired via :meth:`.Session.expire`

        * were expired as the natural effect of committing a session
          transaction, e.g. :meth:`.Session.commit`

        * are normally :term:`lazy loaded` but are not currently loaded

        * are "deferred" via :ref:`deferred` and are not yet loaded

        * were not present in the query which loaded this object, such as that
          which is common in joined table inheritance and other scenarios.

        After :func:`.make_transient` is called, unloaded attributes such
        as those above will normally resolve to the value ``None`` when
        accessed, or an empty collection for a collection-oriented attribute.
        As the object is transient and un-associated with any database
        identity, it will no longer retrieve these values.

    .. seealso::

        :func:`.make_transient_to_detached`

    N(	RRòRRbtexpired_attributesRxt	callablesRcRh(R)RRq((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytmake_transientÊ
s.
					cCs„tj|ƒ}|js!|jr3tjdƒ‚n|jj|ƒ|_|jrZ|`n|j	|j
ƒ|j|j
|jƒdS(s”Make the given transient instance :term:`detached`.

    .. note::

        :func:`.make_transient_to_detached` is a special-case function for
        advanced use cases only.

    All attribute history on the given instance
    will be reset as though the instance were freshly loaded
    from a query.  Missing attributes will be marked as expired.
    The primary key attributes of the object, which are required, will be made
    into the "key" of the instance.

    The object can then be added to a session, or merged
    possibly with the load=False flag, at which point it will look
    as if it were loaded that way, without emitting SQL.

    This is a special use case function that differs from a normal
    call to :meth:`.Session.merge` in that a given persistent state
    can be manufactured without any SQL calls.

    .. versionadded:: 0.9.5

    .. seealso::

        :func:`.make_transient`

    sGiven object must be transientN(
RRòRRcR9R:RÍRRhR0RnRùtunloaded(R)R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pytmake_transient_to_detached
s		cCsGytj|ƒ}Wn#tjk
r8tj|ƒ‚nXt|ƒSdS(s¾Return the :class:`.Session` to which the given instance belongs.

    This is essentially the same as the :attr:`.InstanceState.session`
    accessor.  See that attribute for details.

    N(RRòRRóRôR(R)R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyR(2s
(5R,R\tRRRRR9RâRRRRRR	t
inspectionR
tbaseRRR
RRRRRR\Rt
unitofworkRRRR•t__all__tWeakValueDictionaryRRtobjectRtsymbolR/R0R1R2R3RRRR„R†R(tcounterR½(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/orm/session.pyt<module>sJ".:	ÿØÿÿÿÿÿÿÿÿ%	@	(