]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
deprecate: AsyncSession.close_all()
authorBryan不可思议 <programripper@foxmail.com>
Fri, 6 Oct 2023 06:53:40 +0000 (06:53 +0000)
committerGitHub <noreply@github.com>
Fri, 6 Oct 2023 06:53:40 +0000 (06:53 +0000)
lib/sqlalchemy/ext/asyncio/scoping.py
lib/sqlalchemy/ext/asyncio/session.py

index 3e6d4fc71c9f43bd7e27f4bf2bc7030d2c4a47e6..b2258f4611d132d4512a84e7473940e658cfb2b2 100644 (file)
@@ -1544,7 +1544,7 @@ class async_scoped_session(Generic[_AS]):
         return self._proxied.info
 
     @classmethod
-    async def close_all(self) -> None:
+    async def close_all(cls) -> None:
         r"""Close all :class:`_asyncio.AsyncSession` sessions.
 
         .. container:: class_bases
@@ -1552,6 +1552,9 @@ class async_scoped_session(Generic[_AS]):
             Proxied for the :class:`_asyncio.AsyncSession` class on
             behalf of the :class:`_asyncio.scoping.async_scoped_session` class.
 
+        .. deprecated:: 2.0 The :meth:`.AsyncSession.close_all` method is deprecated and will be removed in a future release.  Please refer to :func:`.session.close_all_sessions`.
+
+
         """  # noqa: E501
 
         return await AsyncSession.close_all()
index 897cc496e85032c8d64ae7ead824de819d7efdcb..429ff6e869a5ddf4b831e159f9d8b53bd5723877 100644 (file)
@@ -1059,7 +1059,11 @@ class AsyncSession(ReversibleProxy[Session]):
 
     @classmethod
     async def close_all(cls) -> None:
-        """Close all :class:`_asyncio.AsyncSession` sessions."""
+        """Close all :class:`_asyncio.AsyncSession` sessions.
+
+        .. deprecated:: 2.0 The :meth:`.AsyncSession.close_all` method is deprecated and will be removed in a future release.  Please refer to :func:`.session.close_all_sessions`.
+
+        """  # noqa: E501
         await greenlet_spawn(close_all_sessions)
 
     async def __aenter__(self: _AS) -> _AS: