summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/session.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-09-01 08:58:06 -0400
committermike bayer <mike_mp@zzzcomputing.com>2021-09-02 14:19:20 +0000
commitd640192877e4d1da75e8dea34d2374c404e80538 (patch)
tree9bb87b162c50ad6385949bc47369388752f020f5 /lib/sqlalchemy/ext/asyncio/session.py
parentbf1fe670513abeb1596bc5266f50db1ffe62f3bd (diff)
downloadsqlalchemy-d640192877e4d1da75e8dea34d2374c404e80538.tar.gz
add asyncio.gather() example; add connection opts
while I dont like this approach very much, people will likely be asking for it a lot, so represent the most correct and efficient form we can handle right now. Added missing ``**kw`` arguments to the :meth:`_asyncio.AsyncSession.connection` method. Change-Id: Idadae2a02a4d96ecb96a5723ce64d017ab4c6217 References: https://github.com/sqlalchemy/sqlalchemy/discussions/6965
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/session.py')
-rw-r--r--lib/sqlalchemy/ext/asyncio/session.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/session.py b/lib/sqlalchemy/ext/asyncio/session.py
index a62c7177c..6b18e3d7c 100644
--- a/lib/sqlalchemy/ext/asyncio/session.py
+++ b/lib/sqlalchemy/ext/asyncio/session.py
@@ -330,13 +330,18 @@ class AsyncSession(ReversibleProxy):
else:
return None
- async def connection(self):
+ async def connection(self, **kw):
r"""Return a :class:`_asyncio.AsyncConnection` object corresponding to
this :class:`.Session` object's transactional state.
+ .. versionadded:: 1.4.24 Added **kw arguments which are passed through
+ to the underlying :meth:`_orm.Session.connection` method.
+
"""
- sync_connection = await greenlet_spawn(self.sync_session.connection)
+ sync_connection = await greenlet_spawn(
+ self.sync_session.connection, **kw
+ )
return engine.AsyncConnection._retrieve_proxy_for_target(
sync_connection
)