
    ,hZ              
         S SK Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S S	KJ
r
  S S
KJr  S SKJr  S SKJr  S SKJr  S SKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \(       a  SSKJr  SSK J!r!  SSK J"r"  SSKJ#r#  SSKJ$r$  SS KJ%r%  SS!KJ&r&  SS"KJ'r'  SS#KJ(r(  SS$KJ)r)  SS%K*J+r+  SS&K*J,r,  SS'K-J.r.  SS(K/J0r0  SS)K/J1r1  SS*K/J2r2  SS+K3J4r4  SS,KJ5r5  SS-KJ6r6  SS.KJ7r7  SS/KJ8r8  SS0K9J:r:  SS1K;J<r<  SS2K=J>r>  SS3K?J@r@  SS4K?JArA  \" S5\S69rB\" \S7S8/ S9Q/ S:Q/ S;QS</S=9 " S> S?\\   5      5       rCg@)A    )annotations)Any)Callable)Generic)Iterable)Iterator)Optional)overload)Sequence)Tuple)Type)TYPE_CHECKING)TypeVar)Union   )_AS)async_sessionmaker)AsyncSession   )exc)util)Session)create_proxy_methods)ScopedRegistry)warn)warn_deprecated)AsyncConnection)AsyncResult)AsyncScalarResult)AsyncSessionTransaction)
Connection)CursorResult)Engine)Result)Row)
RowMapping)_CoreAnyExecuteParams)CoreExecuteOptionsParameter)ScalarResult)_IdentityKeyType)_O)OrmExecuteOptionsParameter)	ORMOption)_BindArguments)_EntityBindKey)_PKIdentityArgument)_SessionBind)
Executable)
UpdateBase)ClauseElement)ForUpdateParameter)TypedReturnsRows_T)boundz:class:`_asyncio.AsyncSession`z.:class:`_asyncio.scoping.async_scoped_session`)	close_allobject_sessionidentity_key)__contains____iter__acloseaddadd_allbeginbegin_nestedcloseresetcommit
connectiondeleteexecuteexpire
expire_allexpungeexpunge_allflushget_bindis_modified
invalidatemergerefreshrollbackscalarscalarsgetget_onestreamstream_scalars)	binddirtydeletednewidentity_map	is_active	autoflushno_autoflushinforV   )classmethodsmethods
attributesuse_intermediate_variablec                     \ rS rSr% SrSrS\S'    S\S'       SMS jr\SNS	 j5       r	SOS
 jr
SPS jrSQS jrSRS jrSSS jrSQS jrSTSUS jjrSVS jrSWS jrSWS jrSQS jrSQS jrSQS jr  SX       SYS jjrSZS jr\ S[\R6                  SSSS.             S\S jjj5       r\ S[\R6                  SSSS.             S]S jjj5       r\ S[\R6                  SSSS.             S^S jjj5       r S[\R6                  SS.           S_S jjjr S[     S`S  jjrSQS! jrSZS" jrSQS# jr S[SaS$ jjr!   Sb         ScS% jjr" ST     SdS& jjr#SQS' jr$SSS(.       SeS) jjr%  SX       SfS* jjr&SQS+ jr'\ S[\R6                  SS.           SgS, jjj5       r(\ S[\R6                  SS.           ShS- jjj5       r( S[\R6                  SS.           ShS. jjjr(\ S[\R6                  SS.           SiS/ jjj5       r)\ S[\R6                  SS.           SjS0 jjj5       r) S[\R6                  SS.           SjS1 jjjr)SS2SS\R6                  S3.               SkS4 jjr*SS2SS\R6                  S3.               SlS5 jjr+\ S[\R6                  SS.           SmS6 jjj5       r,\ S[\R6                  SS.           SnS7 jjj5       r, S[\R6                  SS.           SnS8 jjjr,\ S[\R6                  SS.           SoS9 jjj5       r-\ S[\R6                  SS.           SpS: jjj5       r- S[\R6                  SS.           SpS; jjjr-\SqS< j5       r.\.R^                  SrS= j5       r.\SqS> j5       r0\SqS? j5       r1\SqS@ j5       r2\SqSA j5       r3\3R^                  SrSB j5       r3\SqSC j5       r4\SqSD j5       r5\5R^                  SrSE j5       r5\SqSF j5       r6\SqSG j5       r7\8SQSH j5       r9\8SsSI j5       r:\8  SXSSSSJ.           StSK jjj5       r;SLr<g)uasync_scoped_sessionB   zProvides scoped management of :class:`.AsyncSession` objects.

See the section :ref:`asyncio_scoped_session` for usage details.

.. versionadded:: 1.4.19


Tasync_sessionmaker[_AS]session_factoryzScopedRegistry[_AS]registryc                0    Xl         [        X5      U l        g)ar  Construct a new :class:`_asyncio.async_scoped_session`.

:param session_factory: a factory to create new :class:`_asyncio.AsyncSession`
 instances. This is usually, but not necessarily, an instance
 of :class:`_asyncio.async_sessionmaker`.

:param scopefunc: function which defines
 the current scope.   A function such as ``asyncio.current_task``
 may be useful here.

N)rk   r   rl   )selfrk   	scopefuncs      V/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/ext/asyncio/scoping.py__init__async_scoped_session.__init__   s    "  /&B    c                "    U R                  5       $ N)rl   rn   s    rp   _proxiedasync_scoped_session._proxied   s    }}rs   c                V   U(       ac  U R                   R                  5       (       a  [        R                  " S5      eU R                  " S0 UD6nU R                   R                  U5        OU R                  5       nU R                  (       d  UR                  (       a  [        SS5        U$ )a  Return the current :class:`.AsyncSession`, creating it
using the :attr:`.scoped_session.session_factory` if not present.

:param \**kw: Keyword arguments will be passed to the
 :attr:`.scoped_session.session_factory` callable, if an existing
 :class:`.AsyncSession` is not present.  If the
 :class:`.AsyncSession` is present
 and keyword arguments have been passed,
 :exc:`~sqlalchemy.exc.InvalidRequestError` is raised.

zEScoped session is already present; no new arguments may be specified.zUsing `scoped_session` with asyncio is deprecated and will raise an error in a future version. Please use `async_scoped_session` instead.z1.4.23 )	rl   hassa_excInvalidRequestErrorrk   set_support_async_is_asyncior   )rn   kwsesss      rp   __call__async_scoped_session.__call__   s     }}  ""009 
 ++1b1!!$'==?D""t'7'7= 	 rs   c                    U R                   R                  5       (       a  [        S5        U R                  R                  " S0 UD6  g)zureconfigure the :class:`.sessionmaker` used by this
:class:`.scoped_session`.

See :meth:`.sessionmaker.configure`.

ztAt least one scoped session is already present.  configure() can not affect sessions that have already been created.Nrz   )rl   r{   r   rk   	configure)rn   kwargss     rp   r   async_scoped_session.configure   s=     ==( 	&&00rs   c                   #    U R                   R                  5       (       a&  U R                  5       R                  5       I Sh  vN   U R                   R                  5         g N7f)zDispose of the current :class:`.AsyncSession`, if present.

Different from scoped_session's remove method, this method would use
await to wait for the close method of AsyncSession.

N)rl   r{   rC   clearrv   s    rp   removeasync_scoped_session.remove   sG      ==--/''))) *s   AA%A# A%c                8    U R                   R                  U5      $ )a  Return True if the instance is associated with this session.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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



)rw   r<   rn   instances     rp   r<   !async_scoped_session.__contains__   s    ( }}))(33rs   c                6    U R                   R                  5       $ )ar  Iterate over all pending or persistent instances within this
Session.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.



)rw   r=   rv   s    rp   r=   async_scoped_session.__iter__   s    $ }}%%''rs   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a  A synonym for :meth:`_asyncio.AsyncSession.close`.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

The :meth:`_asyncio.AsyncSession.aclose` name is specifically
to support the Python standard library ``@contextlib.aclosing``
context manager function.

.. versionadded:: 2.0.20


N)rw   r>   rv   s    rp   r>   async_scoped_session.aclose  s      " ]]))++++   '%'c                4    U R                   R                  XS9$ )aD  Place an object into this :class:`_orm.Session`.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

Objects that are in the :term:`transient` state when passed to the
:meth:`_orm.Session.add` method will move to the
:term:`pending` state, until the next flush, at which point they
will move to the :term:`persistent` state.

Objects that are in the :term:`detached` state when passed to the
:meth:`_orm.Session.add` method will move to the :term:`persistent`
state directly.

If the transaction used by the :class:`_orm.Session` is rolled back,
objects which were transient when they were passed to
:meth:`_orm.Session.add` will be moved back to the
:term:`transient` state, and will no longer be present within this
:class:`_orm.Session`.

.. seealso::

    :meth:`_orm.Session.add_all`

    :ref:`session_adding` - at :ref:`session_basics`



)_warn)rw   r?   )rn   r   r   s      rp   r?   async_scoped_session.add  s    L }}   77rs   c                8    U R                   R                  U5      $ )a-  Add the given collection of instances to this :class:`_orm.Session`.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

See the documentation for :meth:`_orm.Session.add` for a general
behavioral description.

.. seealso::

    :meth:`_orm.Session.add`

    :ref:`session_adding` - at :ref:`session_basics`



)rw   r@   )rn   	instancess     rp   r@   async_scoped_session.add_allF  s    4 }}$$Y//rs   c                6    U R                   R                  5       $ )a"  Return an :class:`_asyncio.AsyncSessionTransaction` object.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

The underlying :class:`_orm.Session` will perform the
"begin" action when the :class:`_asyncio.AsyncSessionTransaction`
object is entered::

    async with async_session.begin():
        ...  # ORM transaction is begun

Note that database IO will not normally occur when the session-level
transaction is begun, as database transactions begin on an
on-demand basis.  However, the begin block is async to accommodate
for a :meth:`_orm.SessionEvents.after_transaction_create`
event hook that may perform IO.

For a general description of ORM begin, see
:meth:`_orm.Session.begin`.


)rw   rA   rv   s    rp   rA   async_scoped_session.beginb  s    6 }}""$$rs   c                6    U R                   R                  5       $ )aU  Return an :class:`_asyncio.AsyncSessionTransaction` object
which will begin a "nested" transaction, e.g. SAVEPOINT.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

Behavior is the same as that of :meth:`_asyncio.AsyncSession.begin`.

For a general description of ORM begin nested, see
:meth:`_orm.Session.begin_nested`.

.. seealso::

    :ref:`aiosqlite_serializable` - special workarounds required
    with the SQLite asyncio driver in order for SAVEPOINT to work
    correctly.


)rw   rB   rv   s    rp   rB   !async_scoped_session.begin_nested  s    . }}))++rs   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a  Close out the transactional resources and ORM objects used by this
:class:`_asyncio.AsyncSession`.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.close` - main documentation for
    "close"

    :ref:`session_closing` - detail on the semantics of
    :meth:`_asyncio.AsyncSession.close` and
    :meth:`_asyncio.AsyncSession.reset`.


N)rw   rC   rv   s    rp   rC   async_scoped_session.close  s      * ]]((****r   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a$  Close out the transactional resources and ORM objects used by this
:class:`_orm.Session`, resetting the session to its initial state.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. versionadded:: 2.0.22

.. seealso::

    :meth:`_orm.Session.reset` - main documentation for
    "reset"

    :ref:`session_closing` - detail on the semantics of
    :meth:`_asyncio.AsyncSession.close` and
    :meth:`_asyncio.AsyncSession.reset`.


N)rw   rD   rv   s    rp   rD   async_scoped_session.reset  s      . ]]((****r   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a#  Commit the current transaction in progress.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.commit` - main documentation for
    "commit"

N)rw   rE   rv   s    rp   rE   async_scoped_session.commit  s       ]]))++++r   Nc                \   #    U R                   R                  " SUUS.UD6I Sh  vN $  N7f)ay  Return a :class:`_asyncio.AsyncConnection` object corresponding to
this :class:`.Session` object's transactional state.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

This method may also be used to establish execution options for the
database connection used by the current transaction.

.. versionadded:: 1.4.24  Added \**kw arguments which are passed
   through to the underlying :meth:`_orm.Session.connection` method.

.. seealso::

    :meth:`_orm.Session.connection` - main documentation for
    "connection"


)bind_argumentsexecution_optionsNrz   )rw   rF   )rn   r   r   r   s       rp   rF   async_scoped_session.connection  s=     8 ]]-- 
)/
 
 
 	
 
   #,*,c                T   #    U R                   R                  U5      I Sh  vN $  N7f)a  Mark an instance as deleted.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

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

As this operation may need to cascade along unloaded relationships,
it is awaitable to allow for those queries to take place.

.. seealso::

    :meth:`_orm.Session.delete` - main documentation for delete


N)rw   rG   r   s     rp   rG   async_scoped_session.delete  s"     ( ]]))(3333   (&()r   r   _parent_execute_state
_add_eventc                  #    g 7fru   rz   rn   	statementparamsr   r   r   r   s          rp   rH   async_scoped_session.execute  s
         c                  #    g 7fru   rz   r   s          rp   rH   r     s
       r   c                  #    g 7fru   rz   r   s          rp   rH   r   )  s
      r   )r   r   c               `   #    U R                   R                  " U4UUUS.UD6I Sh  vN $  N7f)a>  Execute a statement and return a buffered
:class:`_engine.Result` object.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.execute` - main documentation for execute


r   r   r   N)rw   rH   rn   r   r   r   r   r   s         rp   rH   r   5  sC     0 ]]**
/)	

 
 
 	
 
   %.,.c                4    U R                   R                  XS9$ )a#  Expire the attributes on an instance.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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`



)attribute_names)rw   rI   )rn   r   r   s      rp   rI   async_scoped_session.expireU  s    h }}##H#NNrs   c                6    U R                   R                  5       $ )aM  Expires all persistent instances within this Session.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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` is not usually needed,
assuming the transaction is isolated.

.. seealso::

    :ref:`session_expire` - introductory material

    :meth:`.Session.expire`

    :meth:`.Session.refresh`

    :meth:`_orm.Query.populate_existing`



)rw   rJ   rv   s    rp   rJ   async_scoped_session.expire_all  s    Z }}''))rs   c                8    U R                   R                  U5      $ )a  Remove the `instance` from this ``Session``.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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



)rw   rK   r   s     rp   rK   async_scoped_session.expunge  s    ( }}$$X..rs   c                6    U R                   R                  5       $ )a  Remove all object instances from this ``Session``.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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



)rw   rL   rv   s    rp   rL    async_scoped_session.expunge_all  s    ( }}((**rs   c                P   #    U R                   R                  US9I Sh  vN $  N7f)a  Flush all the object changes to the database.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.flush` - main documentation for flush


)objectsN)rw   rM   )rn   r   s     rp   rM   async_scoped_session.flush  s%      ]](((9999s   &$&c                @    U R                   R                  " SXUS.UD6$ )a  Return a "bind" to which the synchronous proxied :class:`_orm.Session`
is bound.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

Unlike the :meth:`_orm.Session.get_bind` method, this method is
currently **not** used by this :class:`.AsyncSession` in any way
in order to resolve engines for requests.

.. note::

    This method proxies directly to the :meth:`_orm.Session.get_bind`
    method, however is currently **not** useful as an override target,
    in contrast to that of the :meth:`_orm.Session.get_bind` method.
    The example below illustrates how to implement custom
    :meth:`_orm.Session.get_bind` schemes that work with
    :class:`.AsyncSession` and :class:`.AsyncEngine`.

The pattern introduced at :ref:`session_custom_partitioning`
illustrates how to apply a custom bind-lookup scheme to a
:class:`_orm.Session` given a set of :class:`_engine.Engine` objects.
To apply a corresponding :meth:`_orm.Session.get_bind` implementation
for use with a :class:`.AsyncSession` and :class:`.AsyncEngine`
objects, continue to subclass :class:`_orm.Session` and apply it to
:class:`.AsyncSession` using
:paramref:`.AsyncSession.sync_session_class`. The inner method must
continue to return :class:`_engine.Engine` instances, which can be
acquired from a :class:`_asyncio.AsyncEngine` using the
:attr:`_asyncio.AsyncEngine.sync_engine` attribute::

    # using example from "Custom Vertical Partitioning"


    import random

    from sqlalchemy.ext.asyncio import AsyncSession
    from sqlalchemy.ext.asyncio import create_async_engine
    from sqlalchemy.ext.asyncio import async_sessionmaker
    from sqlalchemy.orm import Session

    # construct async engines w/ async drivers
    engines = {
        "leader": create_async_engine("sqlite+aiosqlite:///leader.db"),
        "other": create_async_engine("sqlite+aiosqlite:///other.db"),
        "follower1": create_async_engine("sqlite+aiosqlite:///follower1.db"),
        "follower2": create_async_engine("sqlite+aiosqlite:///follower2.db"),
    }


    class RoutingSession(Session):
        def get_bind(self, mapper=None, clause=None, **kw):
            # within get_bind(), return sync engines
            if mapper and issubclass(mapper.class_, MyOtherClass):
                return engines["other"].sync_engine
            elif self._flushing or isinstance(clause, (Update, Delete)):
                return engines["leader"].sync_engine
            else:
                return engines[
                    random.choice(["follower1", "follower2"])
                ].sync_engine


    # apply to AsyncSession using sync_session_class
    AsyncSessionMaker = async_sessionmaker(sync_session_class=RoutingSession)

The :meth:`_orm.Session.get_bind` method is called in a non-asyncio,
implicitly non-blocking context in the same manner as ORM event hooks
and functions that are invoked via :meth:`.AsyncSession.run_sync`, so
routines that wish to run SQL commands inside of
:meth:`_orm.Session.get_bind` can continue to do so using
blocking-style code, which will be translated to implicitly async calls
at the point of invoking IO on the database drivers.


)mapperclauserZ   rz   )rw   rN   )rn   r   r   rZ   r   s        rp   rN   async_scoped_session.get_bind  s.    l }}%% 
t
79
 	
rs   c                4    U R                   R                  XS9$ )a/
  Return ``True`` if the given instance has locally
modified attributes.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

This method retrieves the history for each instrumented
attribute on the instance and performs a comparison of the current
value to its previously flushed or 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.



)include_collections)rw   rO   )rn   r   r   s      rp   rO    async_scoped_session.is_modifiedQ  s$    D }}(( ) 
 	
rs   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a  Close this Session, using connection invalidation.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

For a complete description, see :meth:`_orm.Session.invalidate`.

N)rw   rP   rv   s    rp   rP   async_scoped_session.invalidate  s       ]]--////r   loadoptionsc               R   #    U R                   R                  XUS9I Sh  vN $  N7f)a]  Copy the state of a given instance into a corresponding instance
within this :class:`_asyncio.AsyncSession`.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.merge` - main documentation for merge


r   N)rw   rQ   )rn   r   r   r   s       rp   rQ   async_scoped_session.merge  s'     , ]]((g(NNNNr   c                T   #    U R                   R                  UUUS9I Sh  vN $  N7f)a  Expire and refresh the attributes on the given instance.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

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

This is the async version of the :meth:`_orm.Session.refresh` method.
See that method for a complete description of all options.

.. seealso::

    :meth:`_orm.Session.refresh` - main documentation for refresh


)r   with_for_updateN)rw   rR   )rn   r   r   r   s       rp   rR   async_scoped_session.refresh  s6     4 ]]**++ + 
 
 	
 
r   c                R   #    U R                   R                  5       I Sh  vN $  N7f)a)  Rollback the current transaction in progress.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.rollback` - main documentation for
    "rollback"

N)rw   rS   rv   s    rp   rS   async_scoped_session.rollback  s       ]]++----r   c                  #    g 7fru   rz   r   s         rp   rT   async_scoped_session.scalar  s
      r   c                  #    g 7fru   rz   r   s         rp   rT   r     s
      r   c               `   #    U R                   R                  " U4UUUS.UD6I Sh  vN $  N7f)a"  Execute a statement and return a scalar result.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.scalar` - main documentation for scalar


r   N)rw   rT   r   s         rp   rT   r     sC     . ]]))
/)	

 
 
 	
 
r   c                  #    g 7fru   rz   r   s         rp   rU   async_scoped_session.scalars#  
      r   c                  #    g 7fru   rz   r   s         rp   rU   r   .  s
       r   c               `   #    U R                   R                  " U4UUUS.UD6I Sh  vN $  N7f)a1  Execute a statement and return scalar results.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

:return: a :class:`_result.ScalarResult` object

.. versionadded:: 1.4.24 Added :meth:`_asyncio.AsyncSession.scalars`

.. versionadded:: 1.4.26 Added
   :meth:`_asyncio.async_scoped_session.scalars`

.. seealso::

    :meth:`_orm.Session.scalars` - main documentation for scalars

    :meth:`_asyncio.AsyncSession.stream_scalars` - streaming version


r   N)rw   rU   r   s         rp   rU   r   9  sD     @ ]]**
/)	

 
 
 	
 
r   Fr   populate_existingr   identity_tokenr   c          
     `   #    U R                   R                  UUUUUUUS9I Sh  vN nU$  N7f)aE  Return an instance based on the given primary key identifier,
or ``None`` if not found.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. seealso::

    :meth:`_orm.Session.get` - main documentation for get



r   N)rw   rV   )	rn   entityidentr   r   r   r   r   results	            rp   rV   async_scoped_session.geta  sF     6 }}((/+)/ ) 
 
 
s   #.,.c          
     \   #    U R                   R                  UUUUUUUS9I Sh  vN $  N7f)a  Return an instance based on the given primary key identifier,
or raise an exception if not found.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

Raises :class:`_exc.NoResultFound` if the query selects no rows.

..versionadded: 2.0.22

.. seealso::

    :meth:`_orm.Session.get_one` - main documentation for get_one


r   N)rw   rW   )rn   r   r   r   r   r   r   r   s           rp   rW   async_scoped_session.get_one  sB     < ]]**/+)/ + 
 
 	
 
r   c                  #    g 7fru   rz   r   s         rp   rX   async_scoped_session.stream  s
      r   c                  #    g 7fru   rz   r   s         rp   rX   r     r   r   c               `   #    U R                   R                  " U4UUUS.UD6I Sh  vN $  N7f)zExecute a statement and return a streaming
:class:`_asyncio.AsyncResult` object.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.


r   N)rw   rX   r   s         rp   rX   r     sC     ( ]]))
/)	

 
 
 	
 
r   c                  #    g 7fru   rz   r   s         rp   rY   #async_scoped_session.stream_scalars  s
      !$r   c                  #    g 7fru   rz   r   s         rp   rY   r     s
      "%r   c               `   #    U R                   R                  " U4UUUS.UD6I Sh  vN $  N7f)a  Execute a statement and return a stream of scalar results.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

:return: an :class:`_asyncio.AsyncScalarResult` object

.. versionadded:: 1.4.24

.. seealso::

    :meth:`_orm.Session.scalars` - main documentation for scalars

    :meth:`_asyncio.AsyncSession.scalars` - non streaming version


r   N)rw   rY   r   s         rp   rY   r     sC     : ]]11
/)	

 
 
 	
 
r   c                .    U R                   R                  $ )zProxy for the :attr:`_asyncio.AsyncSession.bind` attribute
on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

rw   rZ   rv   s    rp   rZ   async_scoped_session.bind  s     }}!!!rs   c                $    XR                   l        g ru   r   rn   attrs     rp   rZ   r   %  s    !rs   c                .    U R                   R                  $ )a  The set of all persistent instances considered dirty.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.

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.



)rw   r[   rv   s    rp   r[   async_scoped_session.dirty)  s    J }}"""rs   c                .    U R                   R                  $ )ap  The set of all instances marked as 'deleted' within this ``Session``

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.


)rw   r\   rv   s    rp   r\   async_scoped_session.deletedP  s    " }}$$$rs   c                .    U R                   R                  $ )am  The set of all instances marked as 'new' within this ``Session``.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.


)rw   r]   rv   s    rp   r]   async_scoped_session.newc  s    " }}   rs   c                .    U R                   R                  $ )a  Proxy for the :attr:`_orm.Session.identity_map` attribute
on behalf of the :class:`_asyncio.AsyncSession` class.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.


rw   r^   rv   s    rp   r^   !async_scoped_session.identity_mapv  s     }})))rs   c                $    XR                   l        g ru   r  r   s     rp   r^   r    s    %)"rs   c                .    U R                   R                  $ )a  True if this :class:`.Session` not in "partial rollback" state.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.

.. 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`



)rw   r_   rv   s    rp   r_   async_scoped_session.is_active  s    R }}&&&rs   c                .    U R                   R                  $ )a  Proxy for the :attr:`_orm.Session.autoflush` attribute
on behalf of the :class:`_asyncio.AsyncSession` class.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.


rw   r`   rv   s    rp   r`   async_scoped_session.autoflush  s     }}&&&rs   c                $    XR                   l        g ru   r	  r   s     rp   r`   r
    s    "&rs   c                .    U R                   R                  $ )a2  Return a context manager that disables autoflush.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.

e.g.::

    with session.no_autoflush:

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

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



)rw   ra   rv   s    rp   ra   !async_scoped_session.no_autoflush  s    B }})))rs   c                .    U R                   R                  $ )a  A user-modifiable dictionary.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class
    on behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class
    on behalf of the :class:`_asyncio.AsyncSession` class.

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



)rw   rb   rv   s    rp   rb   async_scoped_session.info  s    0 }}!!!rs   c                H   #    [         R                  " 5       I Sh  vN $  N7f)a  Close all :class:`_asyncio.AsyncSession` sessions.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. deprecated:: 2.0 The :meth:`.AsyncSession.close_all` method is deprecated and will be removed in a future release.  Please refer to :func:`_asyncio.close_all_sessions`.

N)r   r9   )clss    rp   r9   async_scoped_session.close_all  s      "++----s   " "c                .    [         R                  " U5      $ )a  Return the :class:`.Session` to which an object belongs.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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



)r   r:   )r  r   s     rp   r:   #async_scoped_session.object_session  s    ( **844rs   )r   rowr   c               2    [         R                  " UUUUUS9$ )au  Return an identity key.

.. container:: class_bases

    Proxied for the :class:`_asyncio.AsyncSession` class on
    behalf of the :class:`_asyncio.scoping.async_scoped_session` class.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_asyncio.AsyncSession` class.

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



)class_r   r   r  r   )r   r;   )r  r  r   r   r  r   s         rp   r;   !async_scoped_session.identity_key)  s&    8 (()
 	
rs   )rl   rk   )rk   rj   ro   zCallable[[], Any])returnr   )r   r   r  r   )r   r   r  None)r  r  )r   objectr  bool)r  zIterator[object])T)r   r  r   r  r  r  )r   zIterable[object]r  r  )r  r    )NN)r   Optional[_BindArguments]r   z%Optional[CoreExecuteOptionsParameter]r   r   r  r   )r   r  r  r  ru   )r   TypedReturnsRows[_T]r   Optional[_CoreAnyExecuteParams]r   r,   r   r  r   Optional[Any]r   r   r  z
Result[_T])r   r3   r   r  r   r,   r   r  r   r   r   r   r  zCursorResult[Any])r   r2   r   r  r   r,   r   r  r   r   r   r   r  Result[Any])r   r2   r   r  r   r,   r   r  r   r   r  r!  )r   r  r   Optional[Iterable[str]]r  r  )r   zOptional[Sequence[Any]]r  r  )NNN)
r   zOptional[_EntityBindKey[_O]]r   zOptional[ClauseElement]rZ   zOptional[_SessionBind]r   r   r  zUnion[Engine, Connection])r   r  r   r  r  r  )r   r+   r   r  r   Optional[Sequence[ORMOption]]r  r+   )r   r  r   r"  r   r5   r  r  )r   TypedReturnsRows[Tuple[_T]]r   r  r   r,   r   r  r   r   r  zOptional[_T])r   r2   r   r  r   r,   r   r  r   r   r  r   )r   r$  r   r  r   r,   r   r  r   r   r  zScalarResult[_T])r   r2   r   r  r   r,   r   r  r   r   r  zScalarResult[Any])r   _EntityBindKey[_O]r   r0   r   r#  r   r  r   r5   r   r   r   r,   r  zUnion[_O, None])r   r%  r   r0   r   r#  r   r  r   r5   r   r   r   r,   r  r+   )r   r  r   r  r   r,   r   r  r   r   r  zAsyncResult[_T])r   r2   r   r  r   r,   r   r  r   r   r  zAsyncResult[Any])r   r$  r   r  r   r,   r   r  r   r   r  zAsyncScalarResult[_T])r   r2   r   r  r   r,   r   r  r   r   r  zAsyncScalarResult[Any])r  r   )r   r   r  r  )r   r  r  zOptional[Session])r  zOptional[Type[Any]]r   zUnion[Any, Tuple[Any, ...]]r   r   r  z%Optional[Union[Row[Any], RowMapping]]r   r   r  z_IdentityKeyType[Any])=__name__
__module____qualname____firstlineno____doc__r   __annotations__rq   propertyrw   r   r   r   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   r
   r   
EMPTY_DICTrH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   setterr[   r\   r]   r^   r_   r`   ra   rb   classmethodr9   r:   r;   __static_attributes__rz   rs   rp   rh   rh   B   s{
   f N,,: "!C0C %C(  @1"
"4,((,&&8P08%:,2+.+2,& 48CG 
0 
 A 
 	 

 
 
D4,  37	
 9=37/3$(	'	 0	
 6	 1	  -	 "	 
	 	  37	 
 9=37/3$(	 	  0	 
 6	  1	   -	  "	  
	  	   37	
 9=37/3$(		 0	
 6	 1	  -	 "	 
	 	 37

 9=37

 0

 6
 1
 
 

B LP4O4O1H4O	4Ol-*^/,+,:& 04*.'+	X
,X
 (X
 %	X

 X
 
#X
v =AD
D
59D
	D
L0$ 15OO 	O
 /O 
O6 48.2	

 1
 ,	

 

@."  37
 9=37. 0
 6 1  
   37
 9=37 0
 6 1  
  37

 9=37

 0

 6
 1
 
 

>  37
 9=37. 0
 6 1  
   37 
 9=37   0 
 6  1    
    37&

 9=37&
&
 0&

 6&
 1&
 &
 
&
Z 26"'.2(,8<$"$ #$
 /$  $ ,$ &$ 6$ 
$V 26"'.2(,8<&
"&
 #&

 /&
  &
 ,&
 &&
 6&
 
&
P  37
 9=37' 0
 6 1  
   37
 9=37 0
 6 1  
  37

 9=37

 0

 6
 1
 
 

8  37$
 9=37$.$ 0$
 6$ 1$ $ 
$ $  37%
 9=37%% 0%
 6% 1% % 
 % % 37#

 9=37#
#
 0#

 6#
 1#
 #
 
 #
J " " 
[[" " $# $#L % %$ ! !$ * * * * (' ('T ' ' ' '  *  *D " "2 . . 5 5*  '+-1!

 #'59(,!
#!
 +!

  !
 3!
 &!
 
!
 !
rs   rh   N)D
__future__r   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   sessionr   r   r    r   r|   r   orm.sessionr   r   r   r   r   enginer   r   r   r   r    r!   r"   r#   r$   r%   r&   engine.interfacesr'   r(   engine.resultr)   orm._typingr*   r+   r,   orm.interfacesr-   r.   r/   r0   r1   sql.baser2   sql.dmlr3   sql.elementsr4   sql.selectabler5   r6   r7   rh   rz   rs   rp   <module>r?     s    #                ' !   " ( "  #'#)0$&  $:@-/!9+--2+&%-42T $4@@
  %ga1dW
73< W
e1dW
rs   