From d640192877e4d1da75e8dea34d2374c404e80538 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 1 Sep 2021 08:58:06 -0400 Subject: 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 --- lib/sqlalchemy/ext/asyncio/session.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/ext/asyncio/session.py') 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 ) -- cgit v1.2.1