Transactions¶
-
tortoise.transactions.atomic(connection_name=
None
)[source]¶ Transaction decorator.
You can wrap your function with this decorator to run it into one transaction. If error occurs transaction will rollback.
-
tortoise.transactions.in_transaction(connection_name=
None
)[source]¶ Transaction context manager.
You can run your code inside
async with in_transaction():
statement to run it into one transaction. If error occurs transaction will rollback.