Skip to content

Commit

Permalink
manager transaction methods are deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
kalombos committed May 12, 2024
1 parent f6f5e94 commit f32ea22
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions peewee_async_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,22 +390,29 @@ 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):
"""
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):
"""
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):
"""
Expand Down

0 comments on commit f32ea22

Please sign in to comment.