PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 131
 ec@sdZddlZddlZddlZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddl$m%Z%ddl&m'Z'd d!d"d#d$d%d&d'gZ(ej)Z*e*e _*d(Z+d)e,fd*YZ-ej.d+Z/ej.d,Z0ej.d-Z1ej.d.Z2ej.d/Z3d#ej4fd0YZ5d!efd1YZ6d e-fd2YZ7d"e-fd3YZ8d4Z9d5Z:d6Z;d7Z<ej=Z>dS(8s1Provides the Session class and related utilities.iNi(t attributes(tcontext(texc(tidentity(tloading(t persistence(tquery(tstate(t_class_to_mapper(t _none_set(t _state_mapper(t instance_str(t object_mapper(t object_state(t state_str(tUOWTransactioni(tengine(tsql(tutil(tTransactionalContext(tinspect(t coercions(tdml(troles(tvisitors(t CompileState(tLABEL_STYLE_TABLENAME_PLUS_COLtSessiontSessionTransactiont sessionmakertORMExecuteStatetclose_all_sessionstmake_transienttmake_transient_to_detachedtobject_sessioncCs|jS(s[Given an :class:`.InstanceState`, return the :class:`.Session` associated, if any. (tsession(R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_state_session=st_SessionClassMethodscBs\eZdZeejdddZeejddZedZ RS(sBClass-level methods for :class:`.Session`, :class:`.sessionmaker`.s1.3sThe :meth:`.Session.close_all` method is deprecated and will be removed in a future release. Please refer to :func:`.session.close_all_sessions`.cCs tdS(sClose *all* sessions in memory.N(R(tcls((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt close_allGs ssqlalchemy.orm.utilcOstjjj||S(sZReturn an identity key. This is an alias of :func:`.util.identity_key`. (Rt preloadedtorm_utilt identity_key(R&targstkwargs((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR*SscCs t|S(sxReturn the :class:`.Session` to which an object belongs. This is an alias of :func:`.object_session`. (R"(R&tinstance((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR"]s( t__name__t __module__t__doc__t classmethodRt deprecatedR'tpreload_moduleR*R"(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR%Ds  tACTIVEtPREPAREDt COMMITTEDtDEACTIVEtCLOSEDc Bs.eZdZdZd Zd Zd d d d d ZedZ edZ edZ edZ edZ edZedZedZdZdZedZedZedZedZedZedZedZRS(!s8Represents a call to the :meth:`_orm.Session.execute` method, as passed to the :meth:`.SessionEvents.do_orm_execute` event hook. .. versionadded:: 1.4 .. seealso:: :ref:`session_execute_events` - top level documentation on how to use :meth:`_orm.SessionEvents.do_orm_execute` R#t statementt parameterstexecution_optionstlocal_execution_optionstbind_argumentst_compile_state_clst_starting_event_idxt _events_todot_update_execution_optionscCs^||_||_||_||_|jj||_||_||_t ||_ dS(N( R#R9R:R<t_execution_optionstunionR;R=R>tlistR@(tselfR#R9R:R;R=tcompile_state_clst events_todo((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt__init__s        cCs|j|jdS(Ni(R@R?(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_remaining_eventsscCs|dkr|j}nt|j}|r=|j|nt|d<|rlt|j}|j|n |j}|j}|r|j|}n|j j ||||d|S(s+Execute the statement represented by this :class:`.ORMExecuteState`, without re-invoking events that have already proceeded. This method essentially performs a re-entrant execution of the current statement for which the :meth:`.SessionEvents.do_orm_execute` event is being currently invoked. The use case for this is for event handlers that want to override how the ultimate :class:`_engine.Result` object is returned, such as for schemes that retrieve results from an offline cache or which concatenate results from multiple executions. When the :class:`_engine.Result` object is returned by the actual handler function within :meth:`_orm.SessionEvents.do_orm_execute` and is propagated to the calling :meth:`_orm.Session.execute` method, the remainder of the :meth:`_orm.Session.execute` method is preempted and the :class:`_engine.Result` object is returned to the caller of :meth:`_orm.Session.execute` immediately. :param statement: optional statement to be invoked, in place of the statement currently represented by :attr:`.ORMExecuteState.statement`. :param params: optional dictionary of parameters which will be merged into the existing :attr:`.ORMExecuteState.parameters` of this :class:`.ORMExecuteState`. :param execution_options: optional dictionary of execution options will be merged into the existing :attr:`.ORMExecuteState.execution_options` of this :class:`.ORMExecuteState`. :param bind_arguments: optional dictionary of bind_arguments which will be merged amongst the current :attr:`.ORMExecuteState.bind_arguments` of this :class:`.ORMExecuteState`. :return: a :class:`_engine.Result` object with ORM-level results. .. seealso:: :ref:`do_orm_execute_re_executing` - background and examples on the appropriate usage of :meth:`_orm.ORMExecuteState.invoke_statement`. t_sa_skip_eventst_parent_execute_stateN( tNoneR9tdictR=tupdatetTrueR:R<RCR#texecute(RER9tparamsR;R=t_bind_argumentst_paramsRB((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytinvoke_statements&6      cCs|jjddS(sReturn the :class:`_orm.Mapper` that is the primary "bind" mapper. For an :class:`_orm.ORMExecuteState` object invoking an ORM statement, that is, the :attr:`_orm.ORMExecuteState.is_orm_statement` attribute is ``True``, this attribute will return the :class:`_orm.Mapper` that is considered to be the "primary" mapper of the statement. The term "bind mapper" refers to the fact that a :class:`_orm.Session` object may be "bound" to multiple :class:`_engine.Engine` objects keyed to mapped classes, and the "bind mapper" determines which of those :class:`_engine.Engine` objects would be selected. For a statement that is invoked against a single mapped class, :attr:`_orm.ORMExecuteState.bind_mapper` is intended to be a reliable way of getting this mapper. .. versionadded:: 1.4.0b2 .. seealso:: :attr:`_orm.ORMExecuteState.all_mappers` tmapperN(R=tgetRL(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt bind_mapperscCs|js gS|jrg}t}xz|jjD]l}|d}|r2t|dt}|r|jr|j|kr|j|j|j |jqq2q2W|S|j s|j r|j gSgSdS(sReturn a sequence of all :class:`_orm.Mapper` objects that are involved at the top level of this statement. By "top level" we mean those :class:`_orm.Mapper` objects that would be represented in the result set rows for a :func:`_sql.select` query, or for a :func:`_dml.update` or :func:`_dml.delete` query, the mapper that is the main subject of the UPDATE or DELETE. .. versionadded:: 1.4.0b2 .. seealso:: :attr:`_orm.ORMExecuteState.bind_mapper` tentitytraiseerrN( tis_orm_statementt is_selecttsetR9tcolumn_descriptionsRtFalseRUtaddtappendt is_updatet is_deleteRW(REtresulttseentdtenttinsp((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt all_mappers s      cCs |jdk S(sreturn True if the operation is an ORM statement. This indicates that the select(), update(), or delete() being invoked contains ORM entities as subjects. For a statement that does not have ORM entities and instead refers only to :class:`.Table` metadata, it is invoked as a Core SQL statement and no ORM-level automation takes place. N(R>RL(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRZ2s cCs |jjS(s*return True if this is a SELECT operation.(R9R[(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR[?scCs|jjo|jjS(s+return True if this is an INSERT operation.(R9tis_dmlt is_insert(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRjDscCs|jjo|jjS(s+return True if this is an UPDATE operation.(R9RiRa(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRaIscCs|jjo|jjS(s*return True if this is a DELETE operation.(R9RiRb(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRbNscCst|jtjtjfS(N(t isinstanceR9RtUpdatetDelete(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_is_crudSscKs|jj||_dS(N(R<RC(REtopts((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytupdate_execution_optionsWscCsS|js dSy|jj}Wntk r1dSX|jtjjrK|SdSdS(N( R[RLR9t_compile_optionstAttributeErrorRkRtORMCompileStatetdefault_compile_options(RERo((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_orm_compile_options[s  cCs |jjS(sAn :class:`.InstanceState` that is using this statement execution for a lazy load operation. The primary rationale for this attribute is to support the horizontal sharding extension, where it is available within specific query execution time hooks created by this extension. To that end, the attribute is only intended to be meaningful at **query execution time**, and importantly not any time prior to that, including query compilation time. (t load_optionst_lazy_loaded_from(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytlazy_loaded_fromgs cCs'|j}|dk r|jSdSdS(sReturn the :class:`.PathRegistry` for the current load path. This object represents the "path" in a query along relationships when a particular object or collection is being loaded. N(RuRLt _current_path(RERo((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytloader_strategy_pathvs  cCs|j}|dk o|jS(sqReturn True if the operation is refreshing column-oriented attributes on an existing ORM object. This occurs during operations such as :meth:`_orm.Session.refresh`, as well as when an attribute deferred by :func:`_orm.defer` is being loaded, or an attribute that was expired either directly by :meth:`_orm.Session.expire` or via a commit operation is being loaded. Handlers will very likely not want to add any options to queries when such an operation is occurring as the query should be a straight primary key fetch which should not have any additional WHERE criteria, and loader options travelling with the instance will have already been added to the query. .. versionadded:: 1.4.0b2 .. seealso:: :attr:`_orm.ORMExecuteState.is_relationship_load` N(RuRLt_for_refresh_state(RERo((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytis_column_loads cCs9|j}|dkrtS|j}|dk o8|j S(szReturn True if this load is loading objects on behalf of a relationship. This means, the loader in effect is either a LazyLoader, SelectInLoader, SubqueryLoader, or similar, and the entire SELECT statement being emitted is on behalf of a relationship load. Handlers will very likely not want to add any options to queries when such an operation is occurring, as loader options are already capable of being propagated to relationship loaders and should be already present. .. seealso:: :attr:`_orm.ORMExecuteState.is_column_load` N(RuRLR^Rztis_root(RERotpath((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytis_relationship_loads    cCs4|jstjdn|jjdtjjS(s=Return the load_options that will be used for this execution.sRThis ORM execution is not against a SELECT statement so there are no load options.t_sa_orm_load_options(R[tsa_exctInvalidRequestErrorR;RVRt QueryContexttdefault_load_options(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRvs    cCs4|jstjdn|jjdtjjS(sNReturn the update_delete_options that will be used for this execution.s_This ORM execution is not against an UPDATE or DELETE statement so there are no update options.t_sa_orm_update_options(RnRRR;RVRtBulkUDCompileStatetdefault_update_options(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytupdate_delete_optionss    cCs1g|jjD] }|j r |j r |^q S(szThe sequence of :class:`.UserDefinedOptions` that have been associated with the statement being invoked. (R9t _with_optionst_is_compile_statet_is_legacy_option(REtopt((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytuser_defined_optionss( R#R9R:R;R<R=R>R?R@RAN(R.R/R0t __slots__RHRIRLRTtpropertyRWRhRZR[RjRaRbRnRpRuRxRzR|RRvRR(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRosD    K%    cBseZdZdZdeedZedZeZ edZ eeeddZ edZ ddZ edZdd Zed Zed Zd Zd ZdZdZedZeedZedZdZdZdZdZRS(sA :class:`.Session`-level transaction. :class:`.SessionTransaction` is produced from the :meth:`_orm.Session.begin` and :meth:`_orm.Session.begin_nested` methods. It's largely an internal object that in modern use provides a context manager for session transactions. Documentation on interacting with :class:`_orm.SessionTransaction` is at: :ref:`unitofwork_transaction`. .. versionchanged:: 1.4 The scoping and API methods to work with the :class:`_orm.SessionTransaction` object directly have been simplified. .. seealso:: :ref:`unitofwork_transaction` :meth:`.Session.begin` :meth:`.Session.begin_nested` :meth:`.Session.rollback` :meth:`.Session.commit` :meth:`.Session.in_transaction` :meth:`.Session.in_nested_transaction` :meth:`.Session.get_transaction` :meth:`.Session.get_nested_transaction` cCstj|||_i|_||_||_|rF|j|_nt|_ | rn|rnt j dn|j d|||j_ |jjj|j|dS(NsOCan't start a SAVEPOINT transaction when no existing transaction is in progresst autobegin(Rt_trans_ctx_checkR#t _connectionst_parenttnestedt_nested_transactiont_previous_nested_transactionR4t_stateRRt_take_snapshott _transactiontdispatchtafter_transaction_create(RER#tparentRR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRH 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 (R(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR)scCs|jdk o|jtkS(N(R#RLRR4(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt is_activeCssThis transaction is closedcCs|jtkr!tjdn|jtkrK|stjdqn|jtkr| r| r|jrtjd|jddq|stjdqqn!|jtkrtj |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.sThis 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: %stcodet7s2asThis session is in 'inactive' state, due to the SQL transaction being rolled back; no further SQL can be emitted within this transaction.( RR6RRR5R7t_rollback_exceptiontPendingRollbackErrorR8tResourceClosedError(REt prepared_okt rollback_okt deactive_okt closed_msg((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_assert_activeGs&    cCs|jp|j S(N(RR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_is_transaction_boundarynscKs/|j|jj||}|j||S(N(RR#tget_bindt_connection_for_bind(REtbindkeyR;R,tbind((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt connectionrs cCs |jt|j|d|S(NR(RRR#(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_beginws cCsk|}d}xX|rf||f7}|j|kr5Pq|jdkrZtjd|q|j}qW|S(Ns4Transaction %s is not on the active transaction list((RRLRR(REtuptotcurrentRc((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_iterate_self_and_parents{s    cCs|jsI|jj|_|jj|_|jj|_|jj|_dS| rm|jj rm|jjnt j |_t j |_t j |_t j |_dS(N( RRt_newt_deletedt_dirtyt _key_switchesR#t _flushingtflushtweakreftWeakKeyDictionary(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs cCsX|jstt|jj|jj}|jj|dtxa|jj D]P\}\}}|jj j |||_ ||krS|jj j |qSqSWx<t|jj|jjD]}|jj|dtqW|jj stxX|jj jD]D}| s1|js1||jkr |j|j|jj jq q WdS(smRestore the restoration state taken before a transaction began. Corresponds to a rollback. t to_transienttrevert_deletionN(RtAssertionErrorR\RRCR#t_expunge_statesRORtitemst identity_mapt safe_discardtkeytreplaceRt _update_implt all_statestmodifiedRt_expireRMt _modified(REt dirty_onlyt to_expungetstoldkeytnewkey((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_restore_snapshots"  %cCs|jst|j r|jjrx6|jjjD]"}|j|j|jjj q8Wt j j t |j|j|jjnd|jr|jjj|j|jjj|j|jjj|j|jjj|jndS(sjRemove the restoration state taken before a transaction began. Corresponds to a commit. N(RRRR#texpire_on_commitRRRRMRtstatelibt InstanceStatet_detach_statesRDRtclearRRRNRR(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_remove_snapshots   cCs|j||jkr>|r/tjdn|j|dSt}t}|jrx|jj||}|js|SnQt |t j r|}|j |jkrt j dqn|j}t}y|r|j|}n|jjr|jdkr|j}n`|jr&|j}nH|jrb|jrM|j}qn|j}t}n |j}Wn|r|jnn[Xt |t j }|||| f|j|<|j|j <|jjj|j|||SdS(NsOConnection is already established for the given bind; execution_options ignoredisMSession already has a Connection associated for the given Connection's Engine(RRRtwarnR^RORRRRkRt ConnectionRRtconnectR;R#ttwophaseRLtbegin_twophaset begin_nestedtin_transactiontin_nested_transactiontget_nested_transactiontget_transactiontbegintcloseRt after_begin(RERR;t local_connectt should_committconnt transactiontbind_is_connection((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRsV           cCs<|jdk s|jj r.tjdn|jdS(NsD'twophase' mode not enabled, or not root transaction; can't prepare.(RRLR#RRRt _prepare_impl(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytprepares cCsV|j|jdks"|jr;|jjj|jn|jj}||k r}x'|jd|D]}|j qfWn|jj sxFt dD]&}|jj rPn|jj qWtjdn|jdkrI|jjrIy2x+t|jjD]}|djqWWqItj|jWdQXqIXnt|_dS(NRidsrOver 100 subsequent flushes have occurred within session.commit() - is an after_flush() hook creating new objects?i(RRRLRR#Rt before_commitRRtcommitRtranget _is_cleanRRt FlushErrorRR\RtvaluesRRt safe_reraisetrollbackR5R(REtstxtsubtransactiont _flush_guardtt((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs,      cCs|jdt|jtk r,|jn|jdksD|jrx<t|j j D]%\}}}}|rZ|j qZqZWt |_|j jj|j |jn|j|r|jr|jj dtS|jS(NRt_to_root(RRORR5RRRLRR\RRRR6R#Rt after_commitRR(RERRttransRt autoclose((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR=s "   c Cs|jdtdt|jj}||k rXx'|jd|D]}|jqAWn|}d}|jtt fkrIx|jD]}|j dks|j r9zkyQx+t |j jD]}|djqWt|_|jjj|jWntj}nXWdt|_|jd|j X|}Pqt|_qWn|j} | r| j rtjd|jd|j n|j|j r|rtjd|j _n|rtj|dd|dn| jj| ||r|j r|j jd tS|j S( NRRRiRs\Session's state has been changed on a non-active transaction - this state will be discarded.twith_tracebackiR(RROR#RRRRLRR4R5RRR\RRRR7Rtafter_rollbacktsystexc_infoRRRRRtraise_tafter_soft_rollback( REt_capture_exceptionRRRtboundaryt rollback_errRRtsess((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRUsL        cCs|jr|j|j_n|j|j_|jdkrxnt|jj D]T\}}}}|rt|j n|r|j r|j n|rO|j qOqOWnt |_|jjj|j|d|_d|_dS(N(RRR#RRRRLR\RRt invalidateRRR8RRtafter_transaction_end(RERRRRR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs  "    cCs|jS(N(R#(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt _get_subjectscCs |jtkS(N(RR4(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_transaction_is_activescCs |jtkS(N(RR8(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_transaction_is_closedscCs|jttfkS(N(RR6R8(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_rollback_can_be_calledsN(R.R/R0RLRR^RHRRRRRRRRRRRRRRRRRRRRRR(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs:%  "      B  :    c Bs4eZdZeZejddWdXeeeeedXedXdXd Z dXZ dXZ dZ dZ ejdZeejdd d d ed Zd ZdZdZdZdZejdZdZejddYeeedZdZdZdZdZdXedXdZ dXdZ!dXej"dXdXdXdZ#dXej"dXdZ$dXej"dXdZ%d Z&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,dXdXdXdXed'Z-d(Z.dXe/j0dXd)Z1eejd*Z2d+Z3dXdXd,Z4d-Z5dXd.Z6d/Z7dXd0Z8d1Z9ed2Z:d3Z;d4Z<d5Z=ed6Z>d7Z?d8Z@d9ZAd:ZBdXedXdXdXd;ZCdXedXdXdXd<ZDedXd=ZEedXdXdXd>ZFd?ZGd@ZHedAZIdBZJdCZKdDZLdEZMdFZNdGZOdHZPdXdIZQdJZRdKZSdXdLZTeeedMZUeedNZVdOZWdPZXedQZYedRZZdXZ[edSZ\edTZ]edUZ^edVZ_RS(ZsManages persistence operations for ORM-mapped objects. The Session's usage paradigm is described at :doc:`/orm/session`. t autocommits2.0sOThe :paramref:`.Session.autocommit` parameter is deprecated and will be removed in SQLAlchemy version 2.0. The :class:`_orm.Session` now features "autobegin" behavior such that the :meth:`.Session.begin` method may be called if a transaction has not yet been started yet. See the section :ref:`session_explicit_begin` for background.c CsAtj|_i|_i|_||_i|_t|_t|_ d|_ d|_ ||_ t|_||_||_||_|r|rtjdnt|_n t|_||_| r| ntj|_| r|jj| n|dk r0x-|jD]\} }|j| |q Wn|t|jsubtransactions are not implemented in future Session objects.Rs/A transaction is already begun on this Session.N( R tNotImplementedErrorR"RRLRRRRRRR(RER#Rt _subtransR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs,0      cCs|jdtS(s"Begin a "nested" transaction on this Session, e.g. SAVEPOINT. The target database(s) and associated drivers must support SQL SAVEPOINT for this method to function correctly. For documentation on SAVEPOINT transactions, please see :ref:`session_begin_nested`. :return: the :class:`.SessionTransaction` object. Note that :class:`.SessionTransaction` acts as a context manager, allowing :meth:`.Session.begin_nested` to be used in a "with" block. See :ref:`session_begin_nested` for a usage example. .. seealso:: :ref:`session_begin_nested` :ref:`pysqlite_serializable` - special workarounds required with the SQLite driver in order for SAVEPOINT to work correctly. R(RRO(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRHscCs,|jdkrn|jjd|jdS(sRollback the current transaction in progress. If no transaction is in progress, this method is a pass-through. In :term:`1.x-style` use, this method rolls back the topmost database transaction if no nested transactions are in effect, or to the current nested transaction if one is in effect. When :term:`2.0-style` use is in effect via the :paramref:`_orm.Session.future` flag, the method always rolls back the topmost database transaction, discarding any nested transactions that may be in progress. .. seealso:: :ref:`session_rollback` :ref:`unitofwork_transaction` RN(RRLRR (RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRascCsJ|jdkr0|js0tjdq0n|jjd|jdS(sEFlush pending changes and commit the current transaction. When the COMMIT operation is complete, all objects are fully :term:`expired`, erasing their internal contents, which will be automatically re-loaded when the objects are next accessed. In the interim, these objects are in an expired state and will not function if they are :term:`detached` from the :class:`.Session`. Additionally, this re-load operation is not supported when using asyncio-oriented APIs. The :paramref:`.Session.expire_on_commit` parameter may be used to disable this behavior. When there is no transaction in place for the :class:`.Session`, indicating that no operations were invoked on this :class:`.Session` since the previous call to :meth:`.Session.commit`, the method will begin and commit an internal-only "logical" transaction, that does not normally affect the database unless pending flush changes were detected, but will still invoke event handlers and object expiration rules. If :term:`1.x-style` use is in effect and there are currently SAVEPOINTs in progress via :meth:`_orm.Session.begin_nested`, the operation will release the current SAVEPOINT but not commit the outermost database transaction. If :term:`2.0-style` use is in effect via the :paramref:`_orm.Session.future` flag, the outermost database transaction is committed unconditionally, automatically releasing any SAVEPOINTs in effect. When using legacy "autocommit" mode, this method is only valid to call if a transaction is actually in progress, else an error is raised. Similarly, when using legacy "subtransactions", the method will instead close out the current "subtransaction", rather than the actual database transaction, if a transaction is in progress. .. seealso:: :ref:`session_committing` :ref:`unitofwork_transaction` :ref:`asyncio_orm_avoid_lazyloads` sNo transaction is begun.RN(RRLR"RRRR (RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR|s. cCsA|jdkr0|js0tjdq0n|jjdS(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(RRLR"RRR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs  cKsX|s|}n|jdd}|dkr?|j|}n|j|d|d|S(sn Return a :class:`_engine.Connection` object corresponding to this :class:`.Session` object's transactional state. If this :class:`.Session` is configured with ``autocommit=False``, either the :class:`_engine.Connection` corresponding to the current transaction is returned, or if no transaction is in progress, a new one is begun and the :class:`_engine.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:`_engine.Connection` is returned using :meth:`_engine.Engine.connect` on the underlying :class:`_engine.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_arguments: dictionary of bind arguments. May include "mapper", "bind", "clause", other custom arguments that are passed to :meth:`.Session.get_bind`. :param bind: deprecated; use bind_arguments :param mapper: deprecated; use bind_arguments :param clause: deprecated; use bind_arguments :param close_with_result: Passed to :meth:`_engine.Engine.connect`, indicating the :class:`_engine.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. .. deprecated:: 1.4 this parameter is deprecated and will be removed in SQLAlchemy 2.0 :param execution_options: a dictionary of execution options that will be passed to :meth:`_engine.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. .. seealso:: :ref:`session_transaction_isolation` :param \**kw: deprecated; use bind_arguments Rtclose_with_resultR;N(tpopRLRR(RER=R&R;tkwR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRsA  cKstj||jdk s(|jr;|jj||S|jdksPt|js_t|j|}|r|j |}n|S(N( RRRRLR"RRRRR;(RERR;R(R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs   cKsUtjtj|}|rGtjd|s7|}qb|j|n|sVi}n t|}|jj dddkrt j |d}nd}tj |}|dk r|j||||||dk \}}n&|jd||jitd6}|r|j} n(|jj} |rCt| |g} n| rt||||||| } x9t| D]+\} } | | _| | } | rt| SqtW| j}| j}n|j|}|jr|j|dt}|jtdt}n|j|}|j||p!i|} |rQ|j |||||| } n| S(sMExecute a SQL expression construct. Returns a :class:`_engine.Result` object representing results of the statement execution. E.g.:: from sqlalchemy import select result = session.execute( select(User).where(User.id == 5) ) The API contract of :meth:`_orm.Session.execute` is similar to that of :meth:`_future.Connection.execute`, the :term:`2.0 style` version of :class:`_future.Connection`. .. versionchanged:: 1.4 the :meth:`_orm.Session.execute` method is now the primary point of ORM statement execution when using :term:`2.0 style` ORM usage. :param statement: An executable statement (i.e. an :class:`.Executable` expression such as :func:`_expression.select`). :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 execution_options: optional dictionary of execution options, which will be associated with the statement execution. This dictionary can provide a subset of the options that are accepted by :meth:`_engine.Connection.execution_options`, and may also provide additional options understood only in an ORM context. :param bind_arguments: dictionary of additional arguments to determine the bind. May include "mapper", "bind", or other custom arguments. Contents of this dictionary are passed to the :meth:`.Session.get_bind` method. :param mapper: deprecated; use the bind_arguments dictionary :param bind: deprecated; use the bind_arguments dictionary :param \**kw: deprecated; use the bind_arguments dictionary :return: a :class:`_engine.Result` object. sPassing bind arguments to Session.execute() as keyword arguments is deprecated and will be removed SQLAlchemy 2.0. Please use the bind_arguments parameter.tcompile_state_plugintormtclauset future_resultR&N(!RtexpectRt StatementRoleRtwarn_deprecated_20RNRMt_propagate_attrsRVRLRt_get_plugin_class_for_plugintcoerce_to_immutabledicttorm_pre_session_exect setdefaultRCRORIRtdo_orm_executeRDRt enumerateR?R9R<RRRR^t _execute_20torm_setup_cursor_result(RER9RQR;R=RKt _add_eventR(RFRGtorm_exec_statetidxtfnRcRR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRPsA             c Ks(|j|d|d|d||jS(sExecute a statement and return a scalar result. Usage and parameters are the same as that of :meth:`_orm.Session.execute`; the return result is a scalar Python value. RQR;R=(RPtscalar(RER9RQR;R=R(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR=s c Ks(|j|d|d|d||jS(sExecute a statement and return the results as scalars. Usage and parameters are the same as that of :meth:`_orm.Session.execute`; the return result is a :class:`_result.ScalarResult` filtering object which will return single elements rather than :class:`_row.Row` objects. :return: a :class:`_result.ScalarResult` object .. versionadded:: 1.4.24 Added :meth:`_orm.Session.scalars` .. versionadded:: 1.4.26 Added :meth:`_orm.scoped_session.scalars` RQR;R=(RPtscalars(RER9RQR;R=R(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR>s cCs|jdtdS(sClose out the transactional resources and ORM objects used by this :class:`_orm.Session`. This expunges all ORM objects associated with this :class:`_orm.Session`, ends any transaction in progress and :term:`releases` any :class:`_engine.Connection` objects which this :class:`_orm.Session` itself has checked out from associated :class:`_engine.Engine` objects. The operation then leaves the :class:`_orm.Session` in a state which it may be used again. .. tip:: The :meth:`_orm.Session.close` method **does not prevent the Session from being used again**. The :class:`_orm.Session` itself does not actually have a distinct "closed" state; it merely means the :class:`_orm.Session` will release all database connections and ORM objects. .. versionchanged:: 1.4 The :meth:`.Session.close` method does not immediately create a new :class:`.SessionTransaction` object; instead, the new :class:`.SessionTransaction` is created only if the :class:`.Session` is used again for a database operation. .. seealso:: :ref:`session_closing` - detail on the semantics of :meth:`_orm.Session.close` RN(t _close_implR^(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRscCs|jdtdS(sClose this Session, using connection invalidation. This is a variant of :meth:`.Session.close` that will additionally ensure that the :meth:`_engine.Connection.invalidate` method will be called on each :class:`_engine.Connection` object that is currently in use for a transaction (typically there is only one connection unless the :class:`_orm.Session` is used with multiple engines). This can be called when the database is known to be in a state where the connections are no longer safe to be used. Below illustrates a scenario when using `gevent `_, which can produce ``Timeout`` exceptions that may mean the underlying connection should be discarded:: import gevent try: sess = Session() sess.add(User()) sess.commit() except gevent.Timeout: sess.invalidate() raise except: sess.rollback() raise The method additionally does everything that :meth:`_orm.Session.close` does, including that all ORM objects are expunged. RN(R?RO(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs"cCsG|j|jdk rCx'|jjD]}|j|q)WndS(N(t expunge_allRRLRR(RERR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR?>s cCsa|jjt|j}|jjtj|_i|_i|_tj j ||dS(sRemove all object instances from this ``Session``. This is equivalent to calling ``expunge(obj)`` on all objects in this ``Session``. N( RRRDRt_killRR RRRR(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR@Ds    cCsyt|}WnUtjk rg}t|tsWtjtjd|d|q||j|` feature instead. 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. Refreshing attributes usually only makes sense at the start of a transaction where database rows have not yet been accessed. :param attribute_names: optional. An iterable collection of string attribute names indicating a subset of attributes to be refreshed. :param with_for_update: optional boolean ``True`` indicating FOR UPDATE should be used, or may be a dictionary containing flags to indicate a more specific set of FOR UPDATE flags for the SELECT; flags should match the parameters of :meth:`_query.Query.with_for_update`. Supersedes the :paramref:`.Session.refresh.lockmode` parameter. .. seealso:: :ref:`session_expire` - introductory material :meth:`.Session.expire` :meth:`.Session.expire_all` :ref:`orm_queryguide_populate_existing` - allows any ORM query to refresh objects as they would be loaded normally. RBsqwith_for_update should be the boolean value True, or a dictionary with options. A blank dictionary is ambiguous.t refresh_statetwith_for_updatetonly_load_propssCould not refresh instance '%s'N(Rtinstance_stateRtNO_STATERRtUnmappedInstanceErrort _expire_stateRRRt ForUpdateArgt_from_argumentRtselectR Rt load_on_identRRLRR (RER-tattribute_namesRfRRItstmt((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytrefreshs,:     cCs7x0|jjD]}|j|j|jjqWdS(sExpires 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` :meth:`_orm.Query.populate_existing` N(RRRRMR(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt expire_all7 s cCs\ytj|}Wn2tjk rG}tjtj|d|nX|j||dS(sExpire 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` :meth:`_orm.Query.populate_existing` RBN(RRhRRiRRRjRk(RER-RpRRI((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytexpireZ s% cCs|j||r)|j|j|nUt|jjjd|}|j|x'|D]\}}}}|j|q[WdS(Nsrefresh-expire(t_validate_persistentt_expire_attributesRMRDtmanagerRUtcascade_iteratort_conditional_expire(RERRptcascadedtotmtst_tdct_((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRk s  cCsX|jr%|j|j|jjn/||jkrT|jj||j|ndS(s5Expire a state if persistent, else expunge if pendingN(RRRMRRRR't_detach(RERR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRy s  c Csytj|}Wn2tjk rG}tjtj|d|nX|j|jk rvt j dt |nt |j jjd|}|j|gg|D]\}}}}|^qdS(sRemove the `instance` from this ``Session``. This will free all internal references to the instance. Cascading will be applied according to the *expunge* cascade rule. RBs*Instance %s is not present in this SessiontexpungeN(RRhRRiRRRjt session_idRRRRRDRwRURxR( RER-RRIRzR{R|R}R~((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s cCsx|D]}||jkr/|jj|q|jj|rg|jj||jj|dq|jr|jjj|dqqWtj j ||d|dS(NR( RR'Rtcontains_stateRRRLRRRR(REtstatesRR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s   c Cs5|jjpd}x|D]{}t|}|j}|dk r|j|}tj|dro|j stj |drt j dt |n|j dkr||_ ns|j |kr,|jj|||jjkr|jj|d}n |j }||f|jj|<||_ n|jj|}|dk r|j||kr|jdk rtjd|fnt|_qqWtjjd|D|j|j||dk rx*|j|jD]}|||qWnx0t|j|jD]}|jj|qWdS(sRegister all persistent objects from a flush. This is used both for pending objects moving to the persistent state as well as already persistent objects. isOInstance %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 as within a load() event.isIdentity map already had an identity for %s, replacing it with newly flushed object. Are there load operations occurring inside of an event handler within the flush?css|]}||jfVqdS(N(RM(t.0R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pys sN(Rtpending_to_persistentRLR RVt_identity_key_from_stateR t intersectiontallow_partial_pkst issupersetRRRRRRRRRRRR^t_orphaned_outside_of_sessionRRt_commit_all_statest_register_alteredRR\R'( RERRRRURVt instance_keytorig_keytold((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt_register_persistent sL            cCsS|jrOxC|D]8}||jkr8t|jj|WdS(Ns save-updatethalt_on(R^Rt_save_or_update_implR Rxt_contains_state(RERRUR{R|R}R~((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRn s     %cCs{|jr|jdnytj|}Wn2tjk r`}tjtj|d|nX|j ||dt dS(sVMark an instance as deleted. The object is assumed to be either :term:`persistent` or :term:`detached` when passed; after the method is called, the object will remain in the :term:`persistent` state until the next flush proceeds. During this time, the object will also be a member of the :attr:`_orm.Session.deleted` collection. When the next flush proceeds, the object will move to the :term:`deleted` state, indicating a ``DELETE`` statement was emitted for its row within the current transaction. When the transaction is successfully committed, the deleted object is moved to the :term:`detached` state and is no longer present within this :class:`_orm.Session`. .. seealso:: :ref:`session_deleting` - at :ref:`session_basics` sSession.delete()RBtheadN( R RRRhRRiRRRjt _delete_implRO(RER-RRI((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytdeletex s  c Cs|jdkr8|r1tjdt|q8dSn|j||}||jkr]dS|jj||r|j ||n|rt |j j j d|}n||j|<|rx0|D]%\}}}} |j||tqWndS(NsInstance '%s' is not persistedR(RRLRRRt_before_attachRRR_t _after_attachRDRwRURxRR^( RERRVRt to_attachtcascade_statesR{R|R}R~((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s$ c Cs1|j||tj|d|d|d|d|S(sReturn an instance based on the given primary key identifier, or ``None`` if not found. E.g.:: my_user = session.get(User, 5) some_object = session.get(VersionedFoo, (5, 10)) some_object = session.get( VersionedFoo, {"id": 5, "version_id": 10} ) .. versionadded:: 1.4 Added :meth:`_orm.Session.get`, which is moved from the now deprecated :meth:`_orm.Query.get` method. :meth:`_orm.Session.get` is special in that it provides direct access to the identity map of the :class:`.Session`. If the given primary key identifier is present in the local identity map, the object is returned directly from this collection and no SQL is emitted, unless the object has been marked fully expired. If not present, a SELECT is performed in order to locate the object. :meth:`_orm.Session.get` also will perform a check if the object is present in the identity map and marked as expired - a SELECT is emitted to refresh the object as well as to ensure that the row is still present. If not, :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised. :param entity: a mapped class or :class:`.Mapper` indicating the type of entity to be loaded. :param ident: A scalar, tuple, or dictionary representing the primary key. For a composite (e.g. multiple column) primary key, a tuple or dictionary should be passed. For a single-column primary key, the scalar calling form is typically the most expedient. If the primary key of a row is the value "5", the call looks like:: my_object = session.get(SomeClass, 5) The tuple form contains primary key values typically in the order in which they correspond to the mapped :class:`_schema.Table` object's primary key columns, or if the :paramref:`_orm.Mapper.primary_key` configuration parameter were used, in the order used for that parameter. For example, if the primary key of a row is represented by the integer digits "5, 10" the call would look like:: my_object = session.get(SomeClass, (5, 10)) The dictionary form should include as keys the mapped attribute names corresponding to each element of the primary key. If the mapped class has the attributes ``id``, ``version_id`` as the attributes which store the object's primary key value, the call would look like:: my_object = session.get(SomeClass, {"id": 5, "version_id": 10}) :param options: optional sequence of loader options which will be applied to the query, if one is emitted. :param populate_existing: causes the method to unconditionally emit a SQL query and refresh the object with the newly loaded data, regardless of whether or not the object is already present. :param with_for_update: optional boolean ``True`` indicating FOR UPDATE should be used, or may be a dictionary containing flags to indicate a more specific set of FOR UPDATE flags for the SELECT; flags should match the parameters of :meth:`_query.Query.with_for_update`. Supersedes the :paramref:`.Session.refresh.lockmode` parameter. :param execution_options: optional dictionary of execution options, which will be associated with the query execution if one is emitted. This dictionary can provide a subset of the options that are accepted by :meth:`_engine.Connection.execution_options`, and may also provide additional options understood only in an ORM context. .. versionadded:: 1.4.29 .. seealso:: :ref:`orm_queryguide_execution_options` - ORM-specific execution options :return: The object instance, or ``None``. tpopulate_existingRfRZR;(t _get_implRtload_on_pk_identity(RERXtidenttoptionsRRfRZR;((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRV sic stdrjnt|} | s;| j rQtjd|ntt} | s~tj ddnt t | j krtj ddjd| j Dn| r| j} | r*t| j} | r*tx#| D]} | | | Q sc3s|]}|jVqdS(N(R(Rtprop(R](sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pys f ssIncorrect names of values in identifier to formulate primary key for session.get(); primary key attribute names are %s (synonym names are also accepted)css|]}d|jVqdS(s'%s'N(R(RR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pys q sRBRZt_populate_existingRv(N(*thasattrRRRFRRRkRMRtto_listRLtlent primary_keyRRTt _pk_synonymsR\RRDt_identity_key_propstKeyErrorRtalways_refreshR_t issubclasst __class__RGRtPASSIVE_CLASS_MISMATCHRRRRRntset_label_styleRRRlRmt_for_update_argRR;(RERXR]t db_load_fnRRRfRZR;RUtis_dictt pk_synonymst correct_keystkRIR-RvR9((R]sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR0 s~  #             c Cs|jr|jdni}i}|r8|jnt||j}zGt|_|jtj|tj |d|d|d|d|SWd||_XdS(s 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. .. versionchanged:: 1.1 - :meth:`.Session.merge` will now reconcile pending objects with overlapping primary keys in the same way as persistent. See :ref:`change_3601` for discussion. :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. :param options: optional sequence of loader options which will be applied to the :meth:`_orm.Session.get` method when the merge operation loads the existing version of the object from the database. .. versionadded:: 1.4.24 .. seealso:: :func:`.make_transient_to_detached` - provides for an alternative means of "merging" a single object into the :class:`.Session` sSession.merge()tloadRt _recursivet_resolve_conflict_mapN( R RRdR RR^t_mergeRRht instance_dict(RER-RRRRR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytmerge s$<       c Cst|}||kr ||St}|j} | dkr||jkrdtjdt|n|s|tj dn|j |} t j | dkot j| d p|jot j| d } nt} | |jkry|j| } Wqtk rd} qXnd} | dkr| rF| |krF|| } q|s|jrgtj dn|jj} t j| } | | _|j| t}q| r|j|j| dd| dd|} qn| dkr(|jj} t j| } t j| } t}|j| nt j| } t j| } | ||<| || <|| k rg|jdk r |j|||jdt j}|j| | |jdt j}|t j k r |t j k r ||kr t!j"d |t| |fq n|j#| _#|j$| _$| j%|x6|j&D](}|j'|||| | |||q8Wn|s| j(| |j| j)j*j+| dn|r| j)j*j,| dn| S( NsrInstance %s is already pending in this Session yet is being merged again; this is probably not what you want to dosmerge() with load=False option does not support objects transient (i.e. unpersisted) objects. flush() all changes on mapped instances before merging with load=False.ismerge() with load=False option does not support objects marked as 'dirty'. flush() all changes on mapped instances before merging with load=False.RZiRR^sVersion 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.(-R R^RRLRRRRRRRRt NEVER_SETR RRRRORRRt class_managert new_instanceRhRRVRGRRtversion_id_colt_get_state_attr_by_columntPASSIVE_NO_INITIALIZEtPASSIVE_NO_RESULTRtStaleDataErrort load_pathRvt_copy_callablestiterate_propertiesRt _commit_allRwRt_sa_event_merge_wo_loadR(RERt state_dictRRRRRURRtkey_is_persistenttmergedt merged_statet merged_dicttexisting_versiontmerged_versionR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s                                cCs2|jj|s.tjdt|ndS(Ns3Instance '%s' is not persistent within this Session(RRRRR(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRu scCs|jdk r+tjdt|n|j}|j||}||jkrz||j|Object '%s' is already attached to session '%s' (this is '%s')( R"RRR^RRRRRt before_attachRO(RERRV((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s "cCsy|j|_|jr0|jdkr0||_n|jj|||jrb|jj||n|jj ||dS(N( RRRt _strong_objRLRt after_attachRtdetached_to_persistentttransient_to_pending(RERRV((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR0 s   cCsUytj|}Wn2tjk rG}tjtj|d|nX|j|S(sReturn True if the instance is associated with this session. The instance may be pending or persistent within the Session for a result of True. RB(RRhRRiRRRjR(RER-RRI((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt __contains__; s cCs,tt|jjt|jjS(sWIterate over all pending or persistent instances within this Session. (titerRDRRR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt__iter__K scCs||jkp|jj|S(N(RRR(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRT scCsV|jrtjdn|jr+dSzt|_|j|Wdt|_XdS(sFlush 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(RRRRROt_flushR^(REtobjects((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRW s   cCstjd|dS(NsUsage 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(REtmethod((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR} scCs"|jj o!|j o!|j S(N(Rtcheck_modifiedRR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s cCs|j}| r8|j r8|j r8|jjjdSt|}|jjrr|jj||||j}nt |j}t |j}t |j |}|rt }xl|D][}yt j |}Wn2t jk r} tjt j|d| nX|j|qWnd}t } |rV|j|j|j |} n|j|j |} x| D]}t|j|} | o|j} | r| r|jr|j|gqu|j|d| }|std| j|quW|r!|j|j | } n|j | } x5| D]-}|j|dt}|s7tdq7W|jsudS|jdt|_ }yt|_!z|j"Wdt#|_!X|jj$|||j%| rF|jjrFt&|jj}t'j(j)g|jjD]}||j*f^q d|jtj+d|n|jj,|||j-Wn*tj.|j/dtWdQXnXdS(NRBtisdeletes*Failed to add object to the flush context!R%RsAttribute 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(0t _dirty_statesRRRRRRRt before_flushR\t differenceRRhRRiRRRjR_RLRCRR t _is_orphant has_identityRRtregister_objectRROthas_workRRR RPR^t after_flushtfinalize_flush_changesRRRRRMRtafter_flush_postexecRRR(RERtdirtyt flush_contexttdeletedtnewtobjsetR{RRIt processedtproct is_orphantis_persistent_orphant_regRtlen_((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s        $        %   c Csd|D}|s.t|dd}nd}xEtj||D]1\\}}} |j|| |t||tqJWdS(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. If the :paramref:`_orm.Session.bulk_save_objects.return_defaults` flag is set, then server-generated primary key values will be assigned to the returned objects, but **not server side defaults**; this is a limitation in the implementation. If stateful objects are desired, please use the standard :meth:`_orm.Session.add_all` approach or as an alternative newer mass-insert features such as :ref:`orm_dml_returning_objects`. .. legacy:: 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. In SQLAlchemy 2.0, improved versions of the bulk insert/update methods are introduced, with clearer behavior and documentation, new capabilities, and much better performance. For 1.4 use, **please read the list of caveats at** :ref:`bulk_operations_caveats` **before using this method, and fully test and confirm the functionality of all code developed using these systems.** :param objects: a sequence 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. It is strongly advised to please use the standard :meth:`_orm.Session.add_all` approach. :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. :param preserve_order: when True, the order of inserts and updates matches exactly the order in which the objects are given. When False, common types of objects are grouped into inserts and updates, to allow for more batching opportunities. .. versionadded:: 1.3 .. seealso:: :ref:`bulk_operations` :meth:`.Session.bulk_insert_mappings` :meth:`.Session.bulk_update_mappings` css|]}tj|VqdS(N(RRh(RRV((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pys gsRcSst|j|jdk fS(N(tidRURRL(R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytpRNcSs|j|jdk fS(N(RURRL(R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt grouping_keyssN(tsortedt itertoolstgroupbyt_bulk_save_mappingsROR^( RERtreturn_defaultstupdate_changed_onlytpreserve_ordert obj_statesRRUtisupdateR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytbulk_save_objectss `  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:`_expression.Insert` constructs, after organizing the values within them across the tables to which the given mapper is mapped. .. versionadded:: 1.0.0 .. legacy:: 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. In SQLAlchemy 2.0, improved versions of the bulk insert/update methods are introduced, with clearer behavior and documentation, new capabilities, and much better performance. For 1.4 use, **please read the list of caveats at** :ref:`bulk_operations_caveats` **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:`_orm.Mapper` object, representing the single kind of object represented within the mapping list. :param mappings: a sequence 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. :param render_nulls: When True, a value of ``None`` will result in a NULL value being included in the INSERT statement, rather than the column being omitted from the INSERT. This allows all the rows being INSERTed to have the identical set of columns which allows the full set of rows to be batched to the DBAPI. Normally, each column-set that contains a different combination of NULL values than the previous row must omit a different series of columns from the rendered INSERT statement, which means it must be emitted as a separate statement. By passing this flag, the full set of rows are guaranteed to be batchable into one batch; the cost however is that server-side defaults which are invoked by an omitted column will be skipped, so care must be taken to ensure that these are not necessary. .. warning:: When this flag is set, **server side default SQL values will not be invoked** for those columns that are inserted as NULL; the NULL value will be sent explicitly. Care must be taken to ensure that no server-side default functions need to be invoked for the operation as a whole. .. versionadded:: 1.1 .. seealso:: :ref:`bulk_operations` :meth:`.Session.bulk_save_objects` :meth:`.Session.bulk_update_mappings` N(RR^(RERUtmappingsRt render_nulls((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytbulk_insert_mappingss_cCs#|j||tttttdS(sPerform 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 .. legacy:: 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. In SQLAlchemy 2.0, improved versions of the bulk insert/update methods are introduced, with clearer behavior and documentation, new capabilities, and much better performance. For 1.4 use, **please read the list of caveats at** :ref:`bulk_operations_caveats` **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:`_orm.Mapper` object, representing the single kind of object represented within the mapping list. :param mappings: a sequence 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(RROR^(RERUR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pytbulk_update_mappingss5c Cst|}t|_|jdt}z}yL|rOtj|||||ntj|||||||jWn*tj |j dtWdQXnXWdt |_XdS(NR%R( RRORRRt _bulk_updatet _bulk_insertRRRRR^( RERURR tisstatesRR RR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR%s0    c Cst|}|jstS|j}x|jjD]o}| rNt|jds/t|jd rgq/n|jj||dtj \}}}|s|r/t Sq/WtSdS(s9 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) 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. tget_collectiont get_historyR^N( R RR^RMRwRRtimplRt NO_CHANGERO( RER-tinclude_collectionsRtdict_tattrtaddedt unchangedR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt is_modifiedMs3     cCs?|jr"|jdk o!|jjS|jdkp:|jjSdS(s4True if this :class:`.Session` not in "partial rollback" state. .. versionchanged:: 1.4 The :class:`_orm.Session` no longer begins a new transaction immediately, so this attribute will be False when the :class:`_orm.Session` is first instantiated. "partial rollback" state typically indicates that the flush process of the :class:`_orm.Session` has failed, and that the :meth:`_orm.Session.rollback` method must be emitted in order to fully roll back the transaction. If this :class:`_orm.Session` is not in a transaction at all, the :class:`_orm.Session` will autobegin when it is first used, so in this case :attr:`_orm.Session.is_active` will return True. Otherwise, if this :class:`_orm.Session` is within a transaction, and that transaction has not been rolled back internally, the :attr:`_orm.Session.is_active` will also return True. .. seealso:: :ref:`faq_session_rollback` :meth:`_orm.Session.in_transaction` N(RRRLR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs cCs |jjS(sThe set of all persistent states considered dirty. This method returns all states that were modified including those that were possibly deleted. (RR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRscCs8tjg|jD]!}||jkr|j^qS(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. (Rt IdentitySetRRRV(RER((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs cCstjt|jjS(sDThe set of all instances marked as 'deleted' within this ``Session``(RRRDRR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRscCstjt|jjS(sAThe set of all instances marked as 'new' within this ``Session``.(RRRDRR(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs(s2.0sOThe :paramref:`.Session.autocommit` parameter is deprecated and will be removed in SQLAlchemy version 2.0. The :class:`_orm.Session` now features "autobegin" behavior such that the :meth:`.Session.begin` method may be called if a transaction has not yet been started yet. See the section :ref:`session_explicit_begin` for background.N(s2.0sThe :paramref:`_orm.Session.begin.subtransactions` flag is deprecated and will be removed in SQLAlchemy version 2.0. See the documentation at :ref:`session_subtransactions` for background on a compatible alternative pattern.(`R.R/R0R^t _is_asyncioRtdeprecated_paramsRLRORHt_trans_context_managertconnection_callableRRtcontextmanagerRRt deprecated_20RR!RRRRtmemoized_propertyRR"RRRRRRRt EMPTY_DICTRPR=R>RRR?R@RRWRLRRRt PASSIVE_OFFR_R`RdRrRsRtRkRyRRRRRR_RRRRRVRRRRuRRRRRRRRRRRRRR RRRRRRRRRR(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs       I   4  J     $       0 ] # .    R   &  " & q mY   &  D    &   ~ xh 9 ( J#  cBsMeZdZdeeeeddZdZdZ dZ dZ 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.:: from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker # an Engine, which the Session will use for connection # resources engine = create_engine('postgresql://scott:tiger@localhost/') Session = sessionmaker(engine) with Session() as session: session.add(some_object) session.add(some_other_object) session.commit() Context manager use is optional; otherwise, the returned :class:`_orm.Session` object may be closed explicitly via the :meth:`_orm.Session.close` method. Using a ``try:/finally:`` block is optional, however will ensure that the close takes place even if there are database errors:: session = Session() try: session.add(some_object) session.add(some_other_object) session.commit() finally: session.close() :class:`.sessionmaker` acts as a factory for :class:`_orm.Session` objects in the same way as an :class:`_engine.Engine` acts as a factory for :class:`_engine.Connection` objects. In this way it also includes a :meth:`_orm.sessionmaker.begin` method, that provides a context manager which both begins and commits a transaction, as well as closes out the :class:`_orm.Session` when complete, rolling back the transaction if any errors occur:: Session = sessionmaker(engine) with Session.begin() as session: session.add(some_object) session.add(some_other_object) # commits transaction, closes session .. versionadded:: 1.4 When calling upon :class:`_orm.sessionmaker` to construct a :class:`_orm.Session`, keyword arguments may also be passed to the method; these arguments will override that of the globally configured parameters. Below we use a :class:`_orm.sessionmaker` bound to a certain :class:`_engine.Engine` to produce a :class:`_orm.Session` that is instead bound to a specific :class:`_engine.Connection` procured from that engine:: Session = sessionmaker(engine) # bind an individual session to a connection with engine.connect() as connection: with Session(bind=connection) as session: # work with session The class also includes a method :meth:`_orm.sessionmaker.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.Engine` objects with an existing :class:`.sessionmaker` factory before it is first used:: # application starts, sessionmaker does not have # an engine bound yet Session = sessionmaker() # ... later, when an engine URL is read from a configuration # file or other events allow the engine to be created engine = create_engine('sqlite:///foo.db') Session.configure(bind=engine) sess = Session() # work with session .. seealso:: :ref:`session_getting` - introductory text on creating sessions using :class:`.sessionmaker`. cKsi||d<||d<||d<||d<|dk rA||ds(RR.RGRTR(R(RE((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyt__repr__s  N( R.R/R0RLRROR^RHRR,R.R/(((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRs] *   cCs%xtjD]}|jq WdS(sOClose all sessions in memory. This function consults a global registry of all :class:`.Session` objects and calls :meth:`.Session.close` on them, which resets them to a clean state. This function is not for general use but may be useful for test suites within the teardown scheme. .. versionadded:: 1.3 N(RRR(R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyRscCs{tj|}t|}|r4|j|gn|jj|jrS|`n|jre|`n|jrw|`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( RRhR$Rtexpired_attributesRt callablesRR(R-RR((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR s.       cCstj|}|js!|jr3tjdn|jj||_|jrZ|`n|j |j |j |j |j dS(sMake 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. .. seealso:: :func:`.make_transient` :meth:`.Session.enable_relationship_loading` sGiven object must be transientN( RRhRRRRRURRRRMRvtunloaded_expirable(R-R((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR!s  cCsVytj|}Wn2tjk rG}tjtj|d|n Xt|SdS(sReturn 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. RBN(RRhRRiRRRjR$(R-RRI((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyR"Es (?R0RRRRNRRRRRRRRRtbaseRR R R R R Rt unitofworkRRRRRt engine.utilRt inspectionRRRRRtsql.baseRtsql.selectableRt__all__tWeakValueDictionaryRR$tobjectR%tsymbolR4R5R6R7R8t MemoizedSlotsRRRRRR R!R"tcounterR (((sI/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/orm/session.pyts       $tV  @ '