From e5606c0ba8bf2fed6daa7a488433d55ddbf302e9 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 19 Jan 2022 22:10:09 +0100 Subject: Added missing method ``invalidate` in the `AsyncSession` Fixes: #7524 Change-Id: I20387e6700015c44f23bd2d05347bdce802196c0 --- lib/sqlalchemy/ext/asyncio/session.py | 7 +++++++ 1 file changed, 7 insertions(+) (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 bb074400a..0840a0d7d 100644 --- a/lib/sqlalchemy/ext/asyncio/session.py +++ b/lib/sqlalchemy/ext/asyncio/session.py @@ -605,6 +605,13 @@ class AsyncSession(ReversibleProxy): """ return await greenlet_spawn(self.sync_session.close) + async def invalidate(self): + """Close this Session, using connection invalidation. + + For a complete description, see :meth:`_orm.Session.invalidate`. + """ + return await greenlet_spawn(self.sync_session.invalidate) + @classmethod async def close_all(self): """Close all :class:`_asyncio.AsyncSession` sessions.""" -- cgit v1.2.1