From f32ea2289ba4bd8d2d457787984a255ab1a558b9 Mon Sep 17 00:00:00 2001 From: kalombo Date: Sun, 12 May 2024 19:44:53 +0500 Subject: [PATCH] manager transaction methods are deprecated --- peewee_async_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/peewee_async_compat.py b/peewee_async_compat.py index 95d8cbf..5053a90 100644 --- a/peewee_async_compat.py +++ b/peewee_async_compat.py @@ -390,6 +390,10 @@ def atomic(self): await objects.create( PageBlock, key='signature', text="William Shakespeare") """ + warnings.warn( + "`atomic` is deprecated, use `database.aio_atomic` method.", + DeprecationWarning + ) return self.database.aio_atomic() def transaction(self): @@ -397,7 +401,10 @@ def transaction(self): Similar to `peewee.Database.transaction()` method, but returns **asynchronous** context manager. """ - + warnings.warn( + "`transaction` is deprecated, use `database.aio_atomic` method.", + DeprecationWarning + ) return self.database.aio_atomic() def savepoint(self, sid=None): @@ -405,7 +412,7 @@ def savepoint(self, sid=None): Similar to `peewee.Database.savepoint()` method, but returns **asynchronous** context manager. """ - raise Exception("The feature didn't work") + raise Exception("`savepoint` feature is disabled use `database.aio_atomic` or Transaction class instead.") def allow_sync(self): """