diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-06 22:56:14 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-07 15:59:59 -0500 |
commit | b45aa7c4062bafae23286c3069571c2596aabc66 (patch) | |
tree | 12d496c61ab71e02ca0fa1c785ee8b34d577b73a /test/dialect/postgresql/test_compiler.py | |
parent | 7f92fdbd8ec479a61c53c11921ce0688ad4dd94b (diff) | |
download | sqlalchemy-b45aa7c4062bafae23286c3069571c2596aabc66.tar.gz |
Implement connection binding for AsyncSession
Implemented "connection-binding" for :class:`.AsyncSession`, the ability to
pass an :class:`.AsyncConnection` to create an :class:`.AsyncSession`.
Previously, this use case was not implemented and would use the associated
engine when the connection were passed. This fixes the issue where the
"join a session to an external transaction" use case would not work
correctly for the :class:`.AsyncSession`. Additionally, added methods
:meth:`.AsyncConnection.in_transaction`,
:meth:`.AsyncConnection.in_nested_transaction`,
:meth:`.AsyncConnection.get_transaction`.
The :class:`.AsyncEngine`, :class:`.AsyncConnection` and
:class:`.AsyncTransaction` objects may be compared using Python ``==`` or
``!=``, which will compare the two given objects based on the "sync" object
they are proxying towards. This is useful as there are cases particularly
for :class:`.AsyncTransaction` where multiple instances of
:class:`.AsyncTransaction` can be proxying towards the same sync
:class:`_engine.Transaction`, and are actually equivalent. The
:meth:`.AsyncConnection.get_transaction` method will currently return a new
proxying :class:`.AsyncTransaction` each time as the
:class:`.AsyncTransaction` is not otherwise statefully associated with its
originating :class:`.AsyncConnection`.
Fixes: #5811
Change-Id: I5a3a6b2f088541eee7b0e0f393510e61bc9f986b
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
0 files changed, 0 insertions, 0 deletions