Atomic database operations: group multiple changes into a single, all-or-nothing transaction for data integrity and reliability.
The transaction()
context manager lets you group multiple database operations into a single atomic unit. Either all changes succeed together, or none are applied if something fails. This is essential for keeping your data safe and consistent.
with db.transaction()
block.See the Basic Usage and Insert API for more examples.