diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-02 12:23:31 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-02 16:09:14 -0400 |
commit | 97d922663a0350c6ce026ecfbde8010ca1bc0c37 (patch) | |
tree | 438b4341441b33cee08b8f01022cd2ff383277f2 /lib/sqlalchemy/sql/compiler.py | |
parent | f51c56b8dca0569269a69bd85c25fcfed39a3c9e (diff) | |
download | sqlalchemy-97d922663a0350c6ce026ecfbde8010ca1bc0c37.tar.gz |
Implement proxy back reference system for asyncio
Implemented a new registry architecture that allows the ``Async`` version
of an object, like ``AsyncSession``, ``AsyncConnection``, etc., to be
locatable given the proxied "sync" object, i.e. ``Session``,
``Connection``. Previously, to the degree such lookup functions were used,
an ``Async`` object would be re-created each time, which was less than
ideal as the identity and state of the "async" object would not be
preserved across calls.
From there, new helper functions :func:`_asyncio.async_object_session`,
:func:`_asyncio.async_session` as well as a new :class:`_orm.InstanceState`
attribute :attr:`_orm.InstanceState.asyncio_session` have been added, which
are used to retrieve the original :class:`_asyncio.AsyncSession` associated
with an ORM mapped object, a :class:`_orm.Session` associated with an
:class:`_asyncio.AsyncSession`, and an :class:`_asyncio.AsyncSession`
associated with an :class:`_orm.InstanceState`, respectively.
This patch also implements new methods
:meth:`_asyncio.AsyncSession.in_nested_transaction`,
:meth:`_asyncio.AsyncSession.get_transaction`,
:meth:`_asyncio.AsyncSession.get_nested_transaction`.
Fixes: #6319
Change-Id: Ia452a7e7ce9bad3ff8846c7dea8d45c839ac9fac
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
0 files changed, 0 insertions, 0 deletions