class_docstr: Provides scoped management of :class:`.AsyncSession` objects.
  
  See the section :ref:`asyncio_scoped_session` for usage details.
  
  .. versionadded:: 1.4.19
class_docstr_tok: ["Provides","scoped","management","of",":","class",":","`",".AsyncSession","`","objects",".","See","the","section",":","ref",":","`","asyncio_scoped_session","`","for","usage","details",".","..","versionadded",":",":","1.4.19"]
docstr: 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.
code: def get_bind(
      self,
      mapper: Optional[_EntityBindKey[_O]] = None,
      clause: Optional[ClauseElement] = None,
      bind: Optional[_SessionBind] = None,
      **kw: Any,
  ) -> Union[Engine, Connection]:
      r"""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.
  
  
      """  # noqa: E501
  
      return self._proxied.get_bind(
          mapper=mapper, clause=clause, bind=bind, **kw
      )
  
imports: from __future__ import annotations
  from typing import Any
  from typing import Callable
  from typing import Generic
  from typing import Iterable
  from typing import Iterator
  from typing import Optional
  from typing import overload
  from typing import Sequence
  from typing import Tuple
  from typing import Type
  from typing import TYPE_CHECKING
  from typing import TypeVar
  from typing import Union
  from .session import _AS
  from .session import async_sessionmaker
  from .session import AsyncSession
  from ...None import exc
  from ...None import util
  from ...orm.session import Session
  from ...util import create_proxy_methods
  from ...util import ScopedRegistry
  from ...util import warn
  from ...util import warn_deprecated
label_desc: Use image node_id 15 for calling the async_scoped_session obj's underlying member method code with example usage: obj.get_bind(mapper, clause, bind) and returns: self