Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
scoping.cpython-313.pyc1622 linesDownload Raw Back to __pycache__
1�

2��j�9�	��SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJ	r	 SS	KJ3r4 SS5KJr SSKJr SSKJ
r
 SS
KJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr SSKJr \(a�SSKJ r  SSKJ!r! SSKJ"r" SSK#J$r$ SS K%J&r& SS!K'J(r( SS"K)J*r* SS#K)J+r+ SS$KJ,r, SS%KJ-r- SS&KJ.r. SS'KJ/r/ SS(KJ0r0 SS)KJ1r1 SS*K2J3r3 SS+K2J4r4 SS,K2J5r5 SS-K2J6r6 SS.K2J7r7 SS/K8J9r9 SS0K8J:r: SS1K8J;r; SS2K<J=r= SS3K>J?r? SS4K>J@r@ SS5K>JArA SS6K>JBrB SS7K>JCrC SS8K>JDrD SS9K>JErE SS:K>JFrF SS;K>JGrG SS<K>JHrI SS=KJJKrK SS>KLJMrM SS?KNJOrO SS@KPJQrQ SSAKPJRrR \"SB\SC9rS"SDSE\5rT\"SF\USC9rVSG/rW\"\SHSI/SJQ/SKQ/SLQSM9"SNSG\\55rX\XrYgO)P�)�annotations)�Any)�Callable)�Dict)�Generic)�Iterable)�Iterator)�Optional)�overload)�Sequence)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�_S)�Session�)�exc)�util)�create_proxy_methods)�ScopedRegistry)�ThreadLocalRegistry)�warn)�warn_deprecated)�Protocol)�_EntityType)�_IdentityKeyType)�OrmExecuteOptionsParameter)�IdentityMap)�	ORMOption)�Mapper)�Query)�RowReturningQuery)�_BindArguments)�_EntityBindKey)�_PKIdentityArgument)�_SessionBind)�sessionmaker)�SessionTransaction)�6Connection)�Engine)�Result)�Row)�7RowMapping)�_CoreAnyExecuteParams)�_CoreSingleExecuteParams)�CoreExecuteOptionsParameter)�ScalarResult)�_ColumnsClauseArgument)�_T0)�_T1)�_T2)�_T3)�_T4)�_T5)�_T6)�_T7)�_TypedColumnClauseArgument)�8Executable)�
ClauseElement)�TypedColumnsClauseRole)�ForUpdateParameter)�TypedReturnsRows�_T)�boundc�"�\rSrSrSrSSjrSrg)�QueryPropertyDescriptor�Oz|Describes the type applied to a class-level9:meth:`_orm.scoped_session.query_property` attribute.10 11.. versionadded:: 2.0.512 13c��g�N�)�self�instance�owners   �\D:\code\apps\devtools\python\user_packages\Python313\site-packages\sqlalchemy/orm/scoping.py�__get__�QueryPropertyDescriptor.__get__Ws��C�rKN)rMrrNzType[_T]�returnz	Query[_T])�__name__�14__module__�__qualname__�__firstlineno__�__doc__rP�__static_attributes__rKrRrOrGrGOs
���HrRrG�_O�scoped_sessionz:class:`_orm.Session`z$:class:`_orm.scoping.scoped_session`)�	close_all�object_session�identity_key)�__contains__�__iter__�add�add_all�begin�begin_nested�close�reset�commit�15connection�delete�execute�expire�16expire_all�expunge�expunge_all�flush�get�get_one�get_bind�is_modified�bulk_save_objects�bulk_insert_mappings�bulk_update_mappings�merge�query�refresh�rollback�scalar�scalars)	�bind�dirty�deleted�new�identity_map�	is_active�	autoflush�no_autoflush�info)�classmethods�methods�17attributesc���\rSrSr%SrSrS\S'S\S'S\S	'SVSWSjjr\SXSj5r	SYS
jr18SZSjrS[SjrSVS\Sjjr
S]SjrS^SjrS_S`SjjrSaSjrSbScSjjrSdSjrS[SjrS[SjrS[SjrSeSfSjjrSgSjr\SV\R6S19S20S21S.ShSjjj5r\SV\R6S22S23S24S.SiSjjj5rSV\R6S25S26S27S.SiS jjjrSVSjS!jjrS[S"jrSgS#jrS[S$jr SVSkS%jjr!S28SS29S30\R6S31S&.SlS'jjr"S32SS33S34\R6S35S&.SmS(jjr#SVS36S37S38SS).SnS*jjjr$S_SoS+jjr%SpSqS,jjr&SrSsS-jjr'StS.jr(SS39S/.SuS0jjr)\SvS1j5r*\SwS2j5r*\SxS3j5r*\SyS4j5r*\SzS5j5r*\S{S6j5r*\S|S7j5r*\S}S8j5r*\S~S9j5r*\SS:j5r*SS;jr*SeS�S<jjr+S[S=jr,\SV\R6S40S>.S�S?jjj5r-\SV\R6S41S>.S�S@jjj5r-SV\R6S42S>.S�SAjjjr-\SV\R6S43S>.S�SBjjj5r.\SV\R6S44S>.S�SCjjj5r.SV\R6S45S>.S�SDjjjr.\S�SEj5r/\/R`S�SFj5r/\S�SGj5r1\S�SHj5r2\S�SIj5r3\S�SJj5r4\4R`S�SKj5r4\S�SLj5r5\S�SMj5r6\6R`S�SNj5r6\S�SOj5r7\S�SPj5r8\9S[SQj5r:\9S�SRj5r;\9SeS46S47S48SS.S�STjjj5r<SUr=g49)�r[�_aProvides scoped management of :class:`.Session` objects.50 51See :ref:`unitofwork_contextual` for a tutorial.52 53.. note::54 55   When using :ref:`asyncio_toplevel`, the async-compatible56   :class:`_asyncio.async_scoped_session` class should be57   used in place of :class:`.scoped_session`.58 59F�bool�_support_async�sessionmaker[_S]�session_factoryzScopedRegistry[_S]�registryNc�`�XlU(a[X5Ulg[U5Ulg)aqConstruct a new :class:`.scoped_session`.60 61:param session_factory: a factory to create new :class:`.Session`62 instances. This is usually, but not necessarily, an instance63 of :class:`.sessionmaker`.64:param scopefunc: optional function which defines65 the current scope.   If not passed, the :class:`.scoped_session`66 object assumes "thread-local" scope, and will use67 a Python ``threading.local()`` in order to maintain the current68 :class:`.Session`.  If passed, the function should return69 a hashable token; this token will be used as the key in a70 dictionary in order to store and retrieve the current71 :class:`.Session`.72 73N)r�rr�r)rLr��	scopefuncs   rO�__init__�scoped_session.__init__�s%��( /���*�?�F�D�M�/��@�D�MrRc�"�UR5$rJ)r��rLs rO�_proxied�scoped_session._proxied�s���}�}��rRc�V�U(acURR5(a[R"S5eUR"S0UD6nURRU5 OUR5nUR(dUR(a[SS5 U$)a�Return the current :class:`.Session`, creating it74using the :attr:`.scoped_session.session_factory` if not present.75 76:param \**kw: Keyword arguments will be passed to the77 :attr:`.scoped_session.session_factory` callable, if an existing78 :class:`.Session` is not present.  If the :class:`.Session` is present79 and keyword arguments have been passed,80 :exc:`~sqlalchemy.exc.InvalidRequestError` is raised.81 82zEScoped session is already present; no new arguments may be specified.z�Using `scoped_session` with asyncio is deprecated and will raise an error in a future version. Please use `async_scoped_session` instead.z1.4.23rK)	r��has�sa_exc�InvalidRequestErrorr��setr��_is_asyncior)rL�kw�sesss   rO�__call__�scoped_session.__call__�s�����}�}� � �"�"��0�0�9���83�+�+�1�b�1���
�
�!�!�$�'��=�=�?�D��"�"�t�'7�'7��=��	
��rRc��URR5(a[S5 URR"S0UD6 g)zureconfigure the :class:`.sessionmaker` used by this84:class:`.scoped_session`.85 86See :meth:`.sessionmaker.configure`.87 88ztAt least one scoped session is already present.  configure() can not affect sessions that have already been created.NrK)r�r�rr��	configure)rL�kwargss  rOr��scoped_session.configure�s=���=�=������(�
�	
���&�&�0��0rRc��URR5(aUR5R5 URR5 g)a�Dispose of the current :class:`.Session`, if present.89 90This will first call :meth:`.Session.close` method91on the current :class:`.Session`, which releases any existing92transactional/connection resources still being held; transactions93specifically are rolled back.  The :class:`.Session` is then94discarded.   Upon next usage within the same scope,95the :class:`.scoped_session` will produce a new96:class:`.Session` object.97 98N)r�r�re�clearr�s rO�remove�scoped_session.remove�s9���=�=������M�M�O�!�!�#��
�
���rRc�0^^�"UU4SjS5nU"5$)areturn a class property which produces a legacy99:class:`_query.Query` object against the class and the current100:class:`.Session` when called.101 102.. legacy:: The :meth:`_orm.scoped_session.query_property` accessor103   is specific to the legacy :class:`.Query` object and is not104   considered to be part of :term:`2.0-style` ORM use.105 106e.g.::107 108    from sqlalchemy.orm import QueryPropertyDescriptor109    from sqlalchemy.orm import scoped_session110    from sqlalchemy.orm import sessionmaker111 112    Session = scoped_session(sessionmaker())113 114 115    class MyClass:116        query: QueryPropertyDescriptor = Session.query_property()117 118 119    # after mappers are defined120    result = MyClass.query.filter(MyClass.name == "foo").all()121 122Produces instances of the session's configured query class by123default.  To override and use a custom implementation, provide124a ``query_cls`` callable.  The callable will be invoked with125the class's mapper as a positional argument and a session126keyword argument.127 128There is no limit to the number of query properties placed on129a class.130 131c�(>�\rSrSrSUU4SjjrSrg)�,scoped_session.query_property.<locals>.queryi,c�z>�T(aT"UTR5S9$TR5RU5$)N)�session)r�rx)�srMrN�	query_clsrLs   ��rOrP�4scoped_session.query_property.<locals>.query.__get__-s2����$�U�D�M�M�O�D�D� �=�=�?�0�0��7�7rRrKN)rMrrNzType[_O]rS�	Query[_O])rTrUrVrWrPrY)r�rLs��rOrxr�,s
���
8�
8rRrxrK)rLr�rxs`` rO�query_property�scoped_session.query_propertys���L	8�	8��w�rRc�8�URRU5$)a!Return True if the instance is associated with this session.132 133.. container:: class_bases134 135    Proxied for the :class:`_orm.Session` class on136    behalf of the :class:`_orm.scoping.scoped_session` class.137 138The instance may be pending or persistent within the Session for a139result of True.140 141 142)r�r_�rLrMs  rOr_�scoped_session.__contains__<s���}�}�)�)�(�3�3rRc�6�URR5$)z�Iterate over all pending or persistent instances within this143Session.144 145.. container:: class_bases146 147    Proxied for the :class:`_orm.Session` class on148    behalf of the :class:`_orm.scoping.scoped_session` class.149 150 151)r�r`r�s rOr`�scoped_session.__iter__Ls���}�}�%�%�'�'rRTc�4�URRXS9$)a�Place an object into this :class:`_orm.Session`.152 153.. container:: class_bases154 155    Proxied for the :class:`_orm.Session` class on156    behalf of the :class:`_orm.scoping.scoped_session` class.157 158Objects that are in the :term:`transient` state when passed to the159:meth:`_orm.Session.add` method will move to the160:term:`pending` state, until the next flush, at which point they161will move to the :term:`persistent` state.162 163Objects that are in the :term:`detached` state when passed to the164:meth:`_orm.Session.add` method will move to the :term:`persistent`165state directly.166 167If the transaction used by the :class:`_orm.Session` is rolled back,168objects which were transient when they were passed to169:meth:`_orm.Session.add` will be moved back to the170:term:`transient` state, and will no longer be present within this171:class:`_orm.Session`.172 173.. seealso::174 175    :meth:`_orm.Session.add_all`176 177    :ref:`session_adding` - at :ref:`session_basics`178 179 180)�_warn)r�ra)rLrMr�s   rOra�scoped_session.addZs��@�}�}� � �� �7�7rRc�8�URRU5$)a�Add the given collection of instances to this :class:`_orm.Session`.181 182.. container:: class_bases183 184    Proxied for the :class:`_orm.Session` class on185    behalf of the :class:`_orm.scoping.scoped_session` class.186 187See the documentation for :meth:`_orm.Session.add` for a general188behavioral description.189 190.. seealso::191 192    :meth:`_orm.Session.add`193 194    :ref:`session_adding` - at :ref:`session_basics`195 196 197)r�rb)rL�	instancess  rOrb�scoped_session.add_all|s��(�}�}�$�$�Y�/�/rRc�4�URRUS9$)a�Begin a transaction, or nested transaction,198on this :class:`.Session`, if one is not already begun.199 200.. container:: class_bases201 202    Proxied for the :class:`_orm.Session` class on203    behalf of the :class:`_orm.scoping.scoped_session` class.204 205The :class:`_orm.Session` object features **autobegin** behavior,206so that normally it is not necessary to call the207:meth:`_orm.Session.begin`208method explicitly. However, it may be used in order to control209the scope of when the transactional state is begun.210 211When used to begin the outermost transaction, an error is raised212if this :class:`.Session` is already inside of a transaction.213 214:param nested: if True, begins a SAVEPOINT transaction and is215 equivalent to calling :meth:`~.Session.begin_nested`. For216 documentation on SAVEPOINT transactions, please see217 :ref:`session_begin_nested`.218 219:return: the :class:`.SessionTransaction` object.  Note that220 :class:`.SessionTransaction`221 acts as a Python context manager, allowing :meth:`.Session.begin`222 to be used in a "with" block.  See :ref:`session_explicit_begin` for223 an example.224 225.. seealso::226 227    :ref:`session_autobegin`228 229    :ref:`unitofwork_transaction`230 231    :meth:`.Session.begin_nested`232 233 234 235)�nested)r�rc)rLr�s  rOrc�scoped_session.begin�s��R�}�}�"�"�&�"�1�1rRc�6�URR5$)a�Begin a "nested" transaction on this Session, e.g. SAVEPOINT.236 237.. container:: class_bases238 239    Proxied for the :class:`_orm.Session` class on240    behalf of the :class:`_orm.scoping.scoped_session` class.241 242The target database(s) and associated drivers must support SQL243SAVEPOINT for this method to function correctly.244 245For documentation on SAVEPOINT246transactions, please see :ref:`session_begin_nested`.247 248:return: the :class:`.SessionTransaction` object.  Note that249 :class:`.SessionTransaction` acts as a context manager, allowing250 :meth:`.Session.begin_nested` to be used in a "with" block.251 See :ref:`session_begin_nested` for a usage example.252 253.. seealso::254 255    :ref:`session_begin_nested`256 257    :ref:`pysqlite_serializable` - special workarounds required258    with the SQLite driver in order for SAVEPOINT to work259    correctly. For asyncio use cases, see the section260    :ref:`aiosqlite_serializable`.261 262 263)r�rdr�s rOrd�scoped_session.begin_nested�s��>�}�}�)�)�+�+rRc�6�URR5$)a�Close out the transactional resources and ORM objects used by this264:class:`_orm.Session`.265 266.. container:: class_bases267 268    Proxied for the :class:`_orm.Session` class on269    behalf of the :class:`_orm.scoping.scoped_session` class.270 271This expunges all ORM objects associated with this272:class:`_orm.Session`, ends any transaction in progress and273:term:`releases` any :class:`_engine.Connection` objects which this274:class:`_orm.Session` itself has checked out from associated275:class:`_engine.Engine` objects. The operation then leaves the276:class:`_orm.Session` in a state which it may be used again.277 278.. tip::279 280    In the default running mode the :meth:`_orm.Session.close`281    method **does not prevent the Session from being used again**.282    The :class:`_orm.Session` itself does not actually have a283    distinct "closed" state; it merely means284    the :class:`_orm.Session` will release all database connections285    and ORM objects.286 287    Setting the parameter :paramref:`_orm.Session.close_resets_only`288    to ``False`` will instead make the ``close`` final, meaning that289    any further action on the session will be forbidden.290 291.. versionchanged:: 1.4  The :meth:`.Session.close` method does not292   immediately create a new :class:`.SessionTransaction` object;293   instead, the new :class:`.SessionTransaction` is created only if294   the :class:`.Session` is used again for a database operation.295 296.. seealso::297 298    :ref:`session_closing` - detail on the semantics of299    :meth:`_orm.Session.close` and :meth:`_orm.Session.reset`.300 301    :meth:`_orm.Session.reset` - a similar method that behaves like302    ``close()`` with  the parameter303    :paramref:`_orm.Session.close_resets_only` set to ``True``.304 305 306)r�rer�s rOre�scoped_session.close�s��\�}�}�"�"�$�$rRc�6�URR5$)aClose out the transactional resources and ORM objects used by this307:class:`_orm.Session`, resetting the session to its initial state.308 309.. container:: class_bases310 311    Proxied for the :class:`_orm.Session` class on312    behalf of the :class:`_orm.scoping.scoped_session` class.313 314This method provides for same "reset-only" behavior that the315:meth:`_orm.Session.close` method has provided historically, where the316state of the :class:`_orm.Session` is reset as though the object were317brand new, and ready to be used again.318This method may then be useful for :class:`_orm.Session` objects319which set :paramref:`_orm.Session.close_resets_only` to ``False``,320so that "reset only" behavior is still available.321 322.. versionadded:: 2.0.22323 324.. seealso::325 326    :ref:`session_closing` - detail on the semantics of327    :meth:`_orm.Session.close` and :meth:`_orm.Session.reset`.328 329    :meth:`_orm.Session.close` - a similar method will additionally330    prevent reuse of the Session when the parameter331    :paramref:`_orm.Session.close_resets_only` is set to ``False``.332 333)r�rfr�s rOrf�scoped_session.resets��<�}�}�"�"�$�$rRc�6�URR5$)aDFlush pending changes and commit the current transaction.334 335.. container:: class_bases336 337    Proxied for the :class:`_orm.Session` class on338    behalf of the :class:`_orm.scoping.scoped_session` class.339 340When the COMMIT operation is complete, all objects are fully341:term:`expired`, erasing their internal contents, which will be342automatically re-loaded when the objects are next accessed. In the343interim, these objects are in an expired state and will not function if344they are :term:`detached` from the :class:`.Session`. Additionally,345this re-load operation is not supported when using asyncio-oriented346APIs. The :paramref:`.Session.expire_on_commit` parameter may be used347to disable this behavior.348 349When there is no transaction in place for the :class:`.Session`,350indicating that no operations were invoked on this :class:`.Session`351since the previous call to :meth:`.Session.commit`, the method will352begin and commit an internal-only "logical" transaction, that does not353normally affect the database unless pending flush changes were354detected, but will still invoke event handlers and object expiration355rules.356 357The outermost database transaction is committed unconditionally,358automatically releasing any SAVEPOINTs in effect.359 360.. seealso::361 362    :ref:`session_committing`363 364    :ref:`unitofwork_transaction`365 366    :ref:`asyncio_orm_avoid_lazyloads`367 368 369)r�rgr�s rOrg�scoped_session.commit.s��N�}�}�#�#�%�%rRc�4�URRXS9$)a	Return a :class:`_engine.Connection` object corresponding to this370:class:`.Session` object's transactional state.371 372.. container:: class_bases373 374    Proxied for the :class:`_orm.Session` class on375    behalf of the :class:`_orm.scoping.scoped_session` class.376 377Either the :class:`_engine.Connection` corresponding to the current378transaction is returned, or if no transaction is in progress, a new379one is begun and the :class:`_engine.Connection`380returned (note that no381transactional state is established with the DBAPI until the first382SQL statement is emitted).383 384Ambiguity in multi-bind or unbound :class:`.Session` objects can be385resolved through any of the optional keyword arguments.   This386ultimately makes usage of the :meth:`.get_bind` method for resolution.387 388:param bind_arguments: dictionary of bind arguments.  May include389 "mapper", "bind", "clause", other custom arguments that are passed390 to :meth:`.Session.get_bind`.391 392:param execution_options: a dictionary of execution options that will393 be passed to :meth:`_engine.Connection.execution_options`, **when the394 connection is first procured only**.   If the connection is already395 present within the :class:`.Session`, a warning is emitted and396 the arguments are ignored.397 398 .. seealso::399 400    :ref:`session_transaction_isolation`401 402 403)�bind_arguments�execution_options)r�rh)rLr�r�s   rOrh�scoped_session.connectionWs$��R�}�}�'�'�)�(�404�	405rRc�8�URRU5$)auMark an instance as deleted.406 407.. container:: class_bases408 409    Proxied for the :class:`_orm.Session` class on410    behalf of the :class:`_orm.scoping.scoped_session` class.411 412The object is assumed to be either :term:`persistent` or413:term:`detached` when passed; after the method is called, the414object will remain in the :term:`persistent` state until the next415flush proceeds.  During this time, the object will also be a member416of the :attr:`_orm.Session.deleted` collection.417 418When the next flush proceeds, the object will move to the419:term:`deleted` state, indicating a ``DELETE`` statement was emitted420for its row within the current transaction.   When the transaction421is successfully committed,422the deleted object is moved to the :term:`detached` state and is423no longer present within this :class:`_orm.Session`.424 425.. seealso::426 427    :ref:`session_deleting` - at :ref:`session_basics`428 429 430)r�rir�s  rOri�scoped_session.delete�s��8�}�}�#�#�H�-�-rR)r�r��_parent_execute_state�431_add_eventc��grJrK�rL�	statement�paramsr�r�r�r�s       rOrj�scoped_session.execute�s��rRc��grJrKr�s       rOrjr��s��rRc	�>�URRUUUUUUS9$)a;Execute a SQL expression construct.432 433.. container:: class_bases434 435    Proxied for the :class:`_orm.Session` class on436    behalf of the :class:`_orm.scoping.scoped_session` class.437 438Returns a :class:`_engine.Result` object representing439results of the statement execution.440 441E.g.::442 443    from sqlalchemy import select444 445    result = session.execute(select(User).where(User.id == 5))446 447The API contract of :meth:`_orm.Session.execute` is similar to that448of :meth:`_engine.Connection.execute`, the :term:`2.0 style` version449of :class:`_engine.Connection`.450 451.. versionchanged:: 1.4 the :meth:`_orm.Session.execute` method is452   now the primary point of ORM statement execution when using453   :term:`2.0 style` ORM usage.454 455:param statement:456    An executable statement (i.e. an :class:`.Executable` expression457    such as :func:`_expression.select`).458 459:param params:460    Optional dictionary, or list of dictionaries, containing461    bound parameter values.   If a single dictionary, single-row462    execution occurs; if a list of dictionaries, an463    "executemany" will be invoked.  The keys in each dictionary464    must correspond to parameter names present in the statement.465 466:param execution_options: optional dictionary of execution options,467 which will be associated with the statement execution.  This468 dictionary can provide a subset of the options that are accepted469 by :meth:`_engine.Connection.execution_options`, and may also470 provide additional options understood only in an ORM context.471 472 .. seealso::473 474    :ref:`orm_queryguide_execution_options` - ORM-specific execution475    options476 477:param bind_arguments: dictionary of additional arguments to determine478 the bind.  May include "mapper", "bind", or other custom arguments.479 Contents of this dictionary are passed to the480 :meth:`.Session.get_bind` method.481 482:return: a :class:`_engine.Result` object.483 484 485 486)r�r�r�r�r�)r�rjr�s       rOrjr��s3��F�}�}�$�$���/�)�"7�!�
%�487�	488rRc�4�URRXS9$)a�Expire the attributes on an instance.489 490.. container:: class_bases491 492    Proxied for the :class:`_orm.Session` class on493    behalf of the :class:`_orm.scoping.scoped_session` class.494 495Marks the attributes of an instance as out of date. When an expired496attribute is next accessed, a query will be issued to the497:class:`.Session` object's current transactional context in order to498load all expired attributes for the given instance.   Note that499a highly isolated transaction will return the same values as were500previously read in that same transaction, regardless of changes501in database state outside of that transaction.502 503To expire all objects in the :class:`.Session` simultaneously,504use :meth:`Session.expire_all`.505 506The :class:`.Session` object's default behavior is to507expire all state whenever the :meth:`Session.rollback`508or :meth:`Session.commit` methods are called, so that new509state can be loaded for the new transaction.   For this reason,510calling :meth:`Session.expire` only makes sense for the specific511case that a non-ORM SQL statement was emitted in the current512transaction.513 514:param instance: The instance to be refreshed.515:param attribute_names: optional list of string attribute names516  indicating a subset of attributes to be expired.517 518.. seealso::519 520    :ref:`session_expire` - introductory material521 522    :meth:`.Session.expire`523 524    :meth:`.Session.refresh`525 526    :meth:`_orm.Query.populate_existing`527 528 529)�attribute_names)r�rk)rLrMr�s   rOrk�scoped_session.expires��\�}�}�#�#�H�#�N�NrRc�6�URR5$)a�Expires all persistent instances within this Session.530 531.. container:: class_bases532 533    Proxied for the :class:`_orm.Session` class on534    behalf of the :class:`_orm.scoping.scoped_session` class.535 536When any attributes on a persistent instance is next accessed,537a query will be issued using the538:class:`.Session` object's current transactional context in order to539load all expired attributes for the given instance.   Note that540a highly isolated transaction will return the same values as were541previously read in that same transaction, regardless of changes542in database state outside of that transaction.543 544To expire individual objects and individual attributes545on those objects, use :meth:`Session.expire`.546 547The :class:`.Session` object's default behavior is to548expire all state whenever the :meth:`Session.rollback`549or :meth:`Session.commit` methods are called, so that new550state can be loaded for the new transaction.   For this reason,551calling :meth:`Session.expire_all` is not usually needed,552assuming the transaction is isolated.553 554.. seealso::555 556    :ref:`session_expire` - introductory material557 558    :meth:`.Session.expire`559 560    :meth:`.Session.refresh`561 562    :meth:`_orm.Query.populate_existing`563 564 565)r�rlr�s rOrl�scoped_session.expire_all6s��N�}�}�'�'�)�)rRc�8�URRU5$)a:Remove the `instance` from this ``Session``.566 567.. container:: class_bases568 569    Proxied for the :class:`_orm.Session` class on570    behalf of the :class:`_orm.scoping.scoped_session` class.571 572This will free all internal references to the instance.  Cascading573will be applied according to the *expunge* cascade rule.574 575 576)r�rmr�s  rOrm�scoped_session.expunge_s���}�}�$�$�X�.�.rRc�6�URR5$)aRemove all object instances from this ``Session``.577 578.. container:: class_bases579 580    Proxied for the :class:`_orm.Session` class on581    behalf of the :class:`_orm.scoping.scoped_session` class.582 583This is equivalent to calling ``expunge(obj)`` on all objects in this584``Session``.585 586 587)r�rnr�s rOrn�scoped_session.expunge_allos���}�}�(�(�*�*rRc�4�URRUS9$)aFlush all the object changes to the database.588 589.. container:: class_bases590 591    Proxied for the :class:`_orm.Session` class on592    behalf of the :class:`_orm.scoping.scoped_session` class.593 594Writes out all pending object creations, deletions and modifications595to the database as INSERTs, DELETEs, UPDATEs, etc.  Operations are596automatically ordered by the Session's unit of work dependency597solver.598 599Database operations will be issued in the current transactional600context and do not affect the state of the transaction, unless an601error occurs, in which case the entire transaction is rolled back.602You may flush() as often as you like within a transaction to move603changes from Python to the database's transaction buffer.604 605:param objects: Optional; restricts the flush operation to operate606  only on elements that are in the given collection.607 608  This feature is for an extremely narrow set of use cases where609  particular objects may need to be operated upon before the610  full flush() occurs.  It is not intended for general use.611 612 613)�objects)r�ro)rLr�s  rOro�scoped_session.flushs��:�}�}�"�"�7�"�3�3rR��options�populate_existing�with_for_update�identity_tokenr�r�c�B�URRUUUUUUUUS9$)aReturn an instance based on the given primary key identifier,614or ``None`` if not found.615 616.. container:: class_bases617 618    Proxied for the :class:`_orm.Session` class on619    behalf of the :class:`_orm.scoping.scoped_session` class.620 621E.g.::622 623    my_user = session.get(User, 5)624 625    some_object = session.get(VersionedFoo, (5, 10))626 627    some_object = session.get(VersionedFoo, {"id": 5, "version_id": 10})628 629.. versionadded:: 1.4 Added :meth:`_orm.Session.get`, which is moved630   from the now legacy :meth:`_orm.Query.get` method.631 632:meth:`_orm.Session.get` is special in that it provides direct633access to the identity map of the :class:`.Session`.634If the given primary key identifier is present635in the local identity map, the object is returned636directly from this collection and no SQL is emitted,637unless the object has been marked fully expired.638If not present,639a SELECT is performed in order to locate the object.640 641:meth:`_orm.Session.get` also will perform a check if642the object is present in the identity map and643marked as expired - a SELECT644is emitted to refresh the object as well as to645ensure that the row is still present.646If not, :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised.647 648:param entity: a mapped class or :class:`.Mapper` indicating the649 type of entity to be loaded.650 651:param ident: A scalar, tuple, or dictionary representing the652 primary key.  For a composite (e.g. multiple column) primary key,653 a tuple or dictionary should be passed.654 655 For a single-column primary key, the scalar calling form is typically656 the most expedient.  If the primary key of a row is the value "5",657 the call looks like::658 659    my_object = session.get(SomeClass, 5)660 661 The tuple form contains primary key values typically in662 the order in which they correspond to the mapped663 :class:`_schema.Table`664 object's primary key columns, or if the665 :paramref:`_orm.Mapper.primary_key` configuration parameter were666 used, in667 the order used for that parameter. For example, if the primary key668 of a row is represented by the integer669 digits "5, 10" the call would look like::670 671     my_object = session.get(SomeClass, (5, 10))672 673 The dictionary form should include as keys the mapped attribute names674 corresponding to each element of the primary key.  If the mapped class675 has the attributes ``id``, ``version_id`` as the attributes which676 store the object's primary key value, the call would look like::677 678    my_object = session.get(SomeClass, {"id": 5, "version_id": 10})679 680:param options: optional sequence of loader options which will be681 applied to the query, if one is emitted.682 683:param populate_existing: causes the method to unconditionally emit684 a SQL query and refresh the object with the newly loaded data,685 regardless of whether or not the object is already present.686 687:param with_for_update: optional boolean ``True`` indicating FOR UPDATE688  should be used, or may be a dictionary containing flags to689  indicate a more specific set of FOR UPDATE flags for the SELECT;690  flags should match the parameters of691  :meth:`_query.Query.with_for_update`.692  Supersedes the :paramref:`.Session.refresh.lockmode` parameter.693 694:param execution_options: optional dictionary of execution options,695 which will be associated with the query execution if one is emitted.696 This dictionary can provide a subset of the options that are697 accepted by :meth:`_engine.Connection.execution_options`, and may698 also provide additional options understood only in an ORM context.699 700 .. versionadded:: 1.4.29701 702 .. seealso::703 704    :ref:`orm_queryguide_execution_options` - ORM-specific execution705    options706 707:param bind_arguments: dictionary of additional arguments to determine708 the bind.  May include "mapper", "bind", or other custom arguments.709 Contents of this dictionary are passed to the710 :meth:`.Session.get_bind` method.711 712 .. versionadded: 2.0.0rc1713 714:return: The object instance, or ``None``.715 716 717r�)r�rp�	rL�entity�identr�r�r�r�r�r�s	         rOrp�scoped_session.get�s9��l�}�}� � ����/�+�)�/�)�!�	718�		719rRc�B�URRUUUUUUUUS9$)abReturn exactly one instance based on the given primary key720identifier, or raise an exception if not found.721 722.. container:: class_bases723 724    Proxied for the :class:`_orm.Session` class on725    behalf of the :class:`_orm.scoping.scoped_session` class.726 727Raises :class:`_exc.NoResultFound` if the query selects no rows.728 729For a detailed documentation of the arguments see the730method :meth:`.Session.get`.731 732.. versionadded:: 2.0.22733 734:return: The object instance.735 736.. seealso::737 738    :meth:`.Session.get` - equivalent method that instead739      returns ``None`` if no row was found with the provided primary740      key741 742 743r�)r�rqr�s	         rOrq�scoped_session.get_ones9��L�}�}�$�$����/�+�)�/�)�%�	744�		745rR)�clauser}�_sa_skip_events�_sa_skip_for_implicit_returningc	�F�URR"SUUUUUS.UD6$)aReturn a "bind" to which this :class:`.Session` is bound.746 747.. container:: class_bases748 749    Proxied for the :class:`_orm.Session` class on750    behalf of the :class:`_orm.scoping.scoped_session` class.751 752The "bind" is usually an instance of :class:`_engine.Engine`,753except in the case where the :class:`.Session` has been754explicitly bound directly to a :class:`_engine.Connection`.755 756For a multiply-bound or unbound :class:`.Session`, the757``mapper`` or ``clause`` arguments are used to determine the758appropriate bind to return.759 760Note that the "mapper" argument is usually present761when :meth:`.Session.get_bind` is called via an ORM762operation such as a :meth:`.Session.query`, each763individual INSERT/UPDATE/DELETE operation within a764:meth:`.Session.flush`, call, etc.765 766The order of resolution is:767 7681. if mapper given and :paramref:`.Session.binds` is present,769   locate a bind based first on the mapper in use, then770   on the mapped class in use, then on any base classes that are771   present in the ``__mro__`` of the mapped class, from more specific772   superclasses to more general.7732. if clause given and ``Session.binds`` is present,774   locate a bind based on :class:`_schema.Table` objects775   found in the given clause present in ``Session.binds``.7763. if ``Session.binds`` is present, return that.7774. if clause given, attempt to return a bind778   linked to the :class:`_schema.MetaData` ultimately779   associated with the clause.7805. if mapper given, attempt to return a bind781   linked to the :class:`_schema.MetaData` ultimately782   associated with the :class:`_schema.Table` or other783   selectable to which the mapper is mapped.7846. No bind can be found, :exc:`~sqlalchemy.exc.UnboundExecutionError`785   is raised.786 787Note that the :meth:`.Session.get_bind` method can be overridden on788a user-defined subclass of :class:`.Session` to provide any kind789of bind resolution scheme.  See the example at790:ref:`session_custom_partitioning`.791 792:param mapper:793  Optional mapped class or corresponding :class:`_orm.Mapper` instance.794  The bind can be derived from a :class:`_orm.Mapper` first by795  consulting the "binds" map associated with this :class:`.Session`,796  and secondly by consulting the :class:`_schema.MetaData` associated797  with the :class:`_schema.Table` to which the :class:`_orm.Mapper` is798  mapped for a bind.799 800:param clause:801    A :class:`_expression.ClauseElement` (i.e.802    :func:`_expression.select`,803    :func:`_expression.text`,804    etc.).  If the ``mapper`` argument is not present or could not805    produce a bind, the given expression construct will be searched806    for a bound element, typically a :class:`_schema.Table`807    associated with808    bound :class:`_schema.MetaData`.809 810.. seealso::811 812     :ref:`session_partitioning`813 814     :paramref:`.Session.binds`815 816     :meth:`.Session.bind_mapper`817 818     :meth:`.Session.bind_table`819 820 821)�mapperr�r}r�r�rK)r�rr)rLr�r�r}r�r�r�s       rOrr�scoped_session.get_bindPs:��p�}�}�%�%�822����+�,K�823��
824�	825rRc�4�URRXS9$)a�	Return ``True`` if the given instance has locally826modified attributes.827 828.. container:: class_bases829 830    Proxied for the :class:`_orm.Session` class on831    behalf of the :class:`_orm.scoping.scoped_session` class.832 833This method retrieves the history for each instrumented834attribute on the instance and performs a comparison of the current835value to its previously flushed or committed value, if any.836 837It is in effect a more expensive and accurate838version of checking for the given instance in the839:attr:`.Session.dirty` collection; a full test for840each attribute's net "dirty" status is performed.841 842E.g.::843 844    return session.is_modified(someobject)845 846A few caveats to this method apply:847 848* Instances present in the :attr:`.Session.dirty` collection may849  report ``False`` when tested with this method.  This is because850  the object may have received change events via attribute mutation,851  thus placing it in :attr:`.Session.dirty`, but ultimately the state852  is the same as that loaded from the database, resulting in no net853  change here.854* Scalar attributes may not have recorded the previously set855  value when a new value was applied, if the attribute was not loaded,856  or was expired, at the time the new value was received - in these857  cases, the attribute is assumed to have a change, even if there is858  ultimately no net change against its database value. SQLAlchemy in859  most cases does not need the "old" value when a set event occurs, so860  it skips the expense of a SQL call if the old value isn't present,861  based on the assumption that an UPDATE of the scalar value is862  usually needed, and in those few cases where it isn't, is less863  expensive on average than issuing a defensive SELECT.864 865  The "old" value is fetched unconditionally upon set only if the866  attribute container has the ``active_history`` flag set to ``True``.867  This flag is set typically for primary key attributes and scalar868  object references that are not a simple many-to-one.  To set this869  flag for any arbitrary mapped column, use the ``active_history``870  argument with :func:`.column_property`.871 872:param instance: mapped instance to be tested for pending changes.873:param include_collections: Indicates if multivalued collections874 should be included in the operation.  Setting this to ``False`` is a875 way to detect only local-column based properties (i.e. scalar columns876 or many-to-one foreign keys) that would result in an UPDATE for this877 instance upon flush.878 879 880)�include_collections)r�rs)rLrMr�s   rOrs�scoped_session.is_modified�s$��x�}�}�(�(��)�881�	882rRc�:�URRUUUUS9$)a�Perform a bulk save of the given list of objects.883 884.. container:: class_bases885 886    Proxied for the :class:`_orm.Session` class on887    behalf of the :class:`_orm.scoping.scoped_session` class.888 889.. legacy::890 891    This method is a legacy feature as of the 2.0 series of892    SQLAlchemy.   For modern bulk INSERT and UPDATE, see893    the sections :ref:`orm_queryguide_bulk_insert` and894    :ref:`orm_queryguide_bulk_update`.895 896    For general INSERT and UPDATE of existing ORM mapped objects,897    prefer standard :term:`unit of work` data management patterns,898    introduced in the :ref:`unified_tutorial` at899    :ref:`tutorial_orm_data_manipulation`.  SQLAlchemy 2.0900    now uses :ref:`engine_insertmanyvalues` with modern dialects901    which solves previous issues of bulk INSERT slowness.902 903:param objects: a sequence of mapped object instances.  The mapped904 objects are persisted as is, and are **not** associated with the905 :class:`.Session` afterwards.906 907 For each object, whether the object is sent as an INSERT or an908 UPDATE is dependent on the same rules used by the :class:`.Session`909 in traditional operation; if the object has the910 :attr:`.InstanceState.key`911 attribute set, then the object is assumed to be "detached" and912 will result in an UPDATE.  Otherwise, an INSERT is used.913 914 In the case of an UPDATE, statements are grouped based on which915 attributes have changed, and are thus to be the subject of each916 SET clause.  If ``update_changed_only`` is False, then all917 attributes present within each object are applied to the UPDATE918 statement, which may help in allowing the statements to be grouped919 together into a larger executemany(), and will also reduce the920 overhead of checking history on attributes.921 922:param return_defaults: when True, rows that are missing values which923 generate defaults, namely integer primary key defaults and sequences,924 will be inserted **one at a time**, so that the primary key value925 is available.  In particular this will allow joined-inheritance926 and other multi-table mappings to insert correctly without the need927 to provide primary key values ahead of time; however,928 :paramref:`.Session.bulk_save_objects.return_defaults` **greatly929 reduces the performance gains** of the method overall.  It is strongly930 advised to please use the standard :meth:`_orm.Session.add_all`931 approach.932 933:param update_changed_only: when True, UPDATE statements are rendered934 based on those attributes in each state that have logged changes.935 When False, all attributes present are rendered into the SET clause936 with the exception of primary key attributes.937 938:param preserve_order: when True, the order of inserts and updates939 matches exactly the order in which the objects are given.   When940 False, common types of objects are grouped into inserts941 and updates, to allow for more batching opportunities.942 943.. seealso::944 945    :doc:`queryguide/dml`946 947    :meth:`.Session.bulk_insert_mappings`948 949    :meth:`.Session.bulk_update_mappings`950 951 952)�return_defaults�update_changed_only�preserve_order)r�rt)rLr�r�r�r�s     rOrt� scoped_session.bulk_save_objects�s-��^�}�}�.�.��+� 3�)�	/�953�	954rRc�:�URRUUUUS9$)a4Perform a bulk insert of the given list of mapping dictionaries.955 956.. container:: class_bases957 958    Proxied for the :class:`_orm.Session` class on959    behalf of the :class:`_orm.scoping.scoped_session` class.960 961.. legacy::962 963    This method is a legacy feature as of the 2.0 series of964    SQLAlchemy.   For modern bulk INSERT and UPDATE, see965    the sections :ref:`orm_queryguide_bulk_insert` and966    :ref:`orm_queryguide_bulk_update`.  The 2.0 API shares967    implementation details with this method and adds new features968    as well.969 970:param mapper: a mapped class, or the actual :class:`_orm.Mapper`971 object,972 representing the single kind of object represented within the mapping973 list.974 975:param mappings: a sequence of dictionaries, each one containing the976 state of the mapped row to be inserted, in terms of the attribute977 names on the mapped class.   If the mapping refers to multiple tables,978 such as a joined-inheritance mapping, each dictionary must contain all979 keys to be populated into all tables.980 981:param return_defaults: when True, the INSERT process will be altered982 to ensure that newly generated primary key values will be fetched.983 The rationale for this parameter is typically to enable984 :ref:`Joined Table Inheritance <joined_inheritance>` mappings to985 be bulk inserted.986 987 .. note:: for backends that don't support RETURNING, the988    :paramref:`_orm.Session.bulk_insert_mappings.return_defaults`989    parameter can significantly decrease performance as INSERT990    statements can no longer be batched.   See991    :ref:`engine_insertmanyvalues`992    for background on which backends are affected.993 994:param render_nulls: When True, a value of ``None`` will result995 in a NULL value being included in the INSERT statement, rather996 than the column being omitted from the INSERT.   This allows all997 the rows being INSERTed to have the identical set of columns which998 allows the full set of rows to be batched to the DBAPI.  Normally,999 each column-set that contains a different combination of NULL values1000 than the previous row must omit a different series of columns from1001 the rendered INSERT statement, which means it must be emitted as a1002 separate statement.   By passing this flag, the full set of rows1003 are guaranteed to be batchable into one batch; the cost however is1004 that server-side defaults which are invoked by an omitted column will1005 be skipped, so care must be taken to ensure that these are not1006 necessary.1007 1008 .. warning::1009 1010    When this flag is set, **server side default SQL values will1011    not be invoked** for those columns that are inserted as NULL;1012    the NULL value will be sent explicitly.   Care must be taken1013    to ensure that no server-side default functions need to be1014    invoked for the operation as a whole.1015 1016.. seealso::1017 1018    :doc:`queryguide/dml`1019 1020    :meth:`.Session.bulk_save_objects`1021 1022    :meth:`.Session.bulk_update_mappings`1023 1024 1025)r��render_nulls)r�ru)rLr��mappingsr�rs     rOru�#scoped_session.bulk_insert_mappingsGs-��`�}�}�1�1���+�%�	2�1026�	1027rRc�8�URRX5$)a0Perform a bulk update of the given list of mapping dictionaries.1028 1029.. container:: class_bases1030 1031    Proxied for the :class:`_orm.Session` class on1032    behalf of the :class:`_orm.scoping.scoped_session` class.1033 1034.. legacy::1035 1036    This method is a legacy feature as of the 2.0 series of1037    SQLAlchemy.   For modern bulk INSERT and UPDATE, see1038    the sections :ref:`orm_queryguide_bulk_insert` and1039    :ref:`orm_queryguide_bulk_update`.  The 2.0 API shares1040    implementation details with this method and adds new features1041    as well.1042 1043:param mapper: a mapped class, or the actual :class:`_orm.Mapper`1044 object,1045 representing the single kind of object represented within the mapping1046 list.1047 1048:param mappings: a sequence of dictionaries, each one containing the1049 state of the mapped row to be updated, in terms of the attribute names1050 on the mapped class.   If the mapping refers to multiple tables, such1051 as a joined-inheritance mapping, each dictionary may contain keys1052 corresponding to all tables.   All those keys which are present and1053 are not part of the primary key are applied to the SET clause of the1054 UPDATE statement; the primary key values, which are required, are1055 applied to the WHERE clause.1056 1057 1058.. seealso::1059 1060    :doc:`queryguide/dml`1061 1062    :meth:`.Session.bulk_insert_mappings`1063 1064    :meth:`.Session.bulk_save_objects`1065 1066 1067)r�rv)rLr�rs   rOrv�#scoped_session.bulk_update_mappings�s��Z�}�}�1�1�&�C�CrR��loadr�c�6�URRXUS9$)a=1068Copy the state of a given instance into a corresponding instance1069within this :class:`.Session`.1070 1071.. container:: class_bases1072 1073    Proxied for the :class:`_orm.Session` class on1074    behalf of the :class:`_orm.scoping.scoped_session` class.1075 1076:meth:`.Session.merge` examines the primary key attributes of the1077source instance, and attempts to reconcile it with an instance of the1078same primary key in the session.   If not found locally, it attempts1079to load the object from the database based on primary key, and if1080none can be located, creates a new instance.  The state of each1081attribute on the source instance is then copied to the target1082instance.  The resulting target instance is then returned by the1083method; the original source instance is left unmodified, and1084un-associated with the :class:`.Session` if not already.1085 1086This operation cascades to associated instances if the association is1087mapped with ``cascade="merge"``.1088 1089See :ref:`unitofwork_merging` for a detailed discussion of merging.1090 1091:param instance: Instance to be merged.1092:param load: Boolean, when False, :meth:`.merge` switches into1093 a "high performance" mode which causes it to forego emitting history1094 events as well as all database access.  This flag is used for1095 cases such as transferring graphs of objects into a :class:`.Session`1096 from a second level cache, or to transfer just-loaded objects1097 into the :class:`.Session` owned by a worker thread or process1098 without re-querying the database.1099 1100 The ``load=False`` use case adds the caveat that the given1101 object has to be in a "clean" state, that is, has no pending changes1102 to be flushed - even if the incoming object is detached from any1103 :class:`.Session`.   This is so that when1104 the merge operation populates local attributes and1105 cascades to related objects and1106 collections, the values can be "stamped" onto the1107 target object as is, without generating any history or attribute1108 events, and without the need to reconcile the incoming data with1109 any existing related objects or collections that might not1110 be loaded.  The resulting objects from ``load=False`` are always1111 produced as "clean", so it is only appropriate that the given objects1112 should be "clean" as well, else this suggests a mis-use of the1113 method.1114:param options: optional sequence of loader options which will be1115 applied to the :meth:`_orm.Session.get` method when the merge1116 operation loads the existing version of the object from the database.1117 1118 .. versionadded:: 1.4.241119 1120 1121.. seealso::1122 1123    :func:`.make_transient_to_detached` - provides for an alternative1124    means of "merging" a single object into the :class:`.Session`1125 1126 1127r)r�rw)rLrMrr�s    rOrw�scoped_session.merge�s��H�}�}�"�"�8��"�H�HrRc��grJrK)rL�_entitys  rOrx�scoped_session.querys��<?rRc��grJrK)rL�_colexprs  rOrxrs��(+rRc��grJrK)rL�_scoped_session__ent0�_scoped_session__ent1s   rOrxr s��.1rRc��grJrK)rLrr�_scoped_session__ent2s    rOrxr%s��36rRc��grJrK)rLrrr�_scoped_session__ent3s     rOrxr*s��8;rRc��grJrK)rLrrrr�_scoped_session__ent4s      rOrxr3s��=@rRc��grJrK)rLrrrrr�_scoped_session__ent5s       rOrxr=s	��BErRc��grJrK)rLrrrrrr�_scoped_session__ent6s        rOrxrHs	��GJrRc	��grJrK)	rLrrrrrrr�_scoped_session__ent7s	         rOrxrTs	��LOrRc��grJrK�rL�entitiesr�s   rOrxrcs��rRc�:�URR"U0UD6$)a�Return a new :class:`_query.Query` object corresponding to this1128:class:`_orm.Session`.1129 1130.. container:: class_bases1131 1132    Proxied for the :class:`_orm.Session` class on1133    behalf of the :class:`_orm.scoping.scoped_session` class.1134 1135Note that the :class:`_query.Query` object is legacy as of1136SQLAlchemy 2.0; the :func:`_sql.select` construct is now used1137to construct ORM queries.1138 1139.. seealso::1140 1141    :ref:`unified_tutorial`1142 1143    :ref:`queryguide_toplevel`1144 1145    :ref:`query_api_toplevel` - legacy API doc1146 1147 1148)r�rxrs   rOrxrhs��4�}�}�"�"�H�7��7�7rRc�8�URRUUUS9$)aExpire and refresh attributes on the given instance.1149 1150.. container:: class_bases1151 1152    Proxied for the :class:`_orm.Session` class on1153    behalf of the :class:`_orm.scoping.scoped_session` class.1154 1155The selected attributes will first be expired as they would when using1156:meth:`_orm.Session.expire`; then a SELECT statement will be issued to1157the database to refresh column-oriented attributes with the current1158value available in the current transaction.1159 1160:func:`_orm.relationship` oriented attributes will also be immediately1161loaded if they were already eagerly loaded on the object, using the1162same eager loading strategy that they were loaded with originally.1163 1164.. versionadded:: 1.4 - the :meth:`_orm.Session.refresh` method1165   can also refresh eagerly loaded attributes.1166 1167:func:`_orm.relationship` oriented attributes that would normally1168load using the ``select`` (or "lazy") loader strategy will also1169load **if they are named explicitly in the attribute_names1170collection**, emitting a SELECT statement for the attribute using the1171``immediate`` loader strategy.  If lazy-loaded relationships are not1172named in :paramref:`_orm.Session.refresh.attribute_names`, then1173they remain as "lazy loaded" attributes and are not implicitly1174refreshed.1175 1176.. versionchanged:: 2.0.4  The :meth:`_orm.Session.refresh` method1177   will now refresh lazy-loaded :func:`_orm.relationship` oriented1178   attributes for those which are named explicitly in the1179   :paramref:`_orm.Session.refresh.attribute_names` collection.1180 1181.. tip::1182 1183    While the :meth:`_orm.Session.refresh` method is capable of1184    refreshing both column and relationship oriented attributes, its1185    primary focus is on refreshing of local column-oriented attributes1186    on a single instance. For more open ended "refresh" functionality,1187    including the ability to refresh the attributes on many objects at1188    once while having explicit control over relationship loader1189    strategies, use the1190    :ref:`populate existing <orm_queryguide_populate_existing>` feature1191    instead.1192 1193Note that a highly isolated transaction will return the same values as1194were previously read in that same transaction, regardless of changes1195in database state outside of that transaction.   Refreshing1196attributes usually only makes sense at the start of a transaction1197where database rows have not yet been accessed.1198 1199:param attribute_names: optional.  An iterable collection of1200  string attribute names indicating a subset of attributes to

Showing the first 1,200 of 1622 lines. Download the file for the rest.

codekingpro/portable-devtools · Team Ai