Savepoints & Nesting — Aquilia Documentation
Comprehensive guide and documentation for Savepoints & Nesting in the Aquilia framework. View API reference, examples, and implementation patterns.
Docs / Models / Savepoints & Nesting Savepoints & Nesting Nesting transaction blocks automatically maps to SQL SAVEPOINT statements, allowing selective inner rollbacks. Nesting and Isolation The outermost atomic() block initiates a transaction. Nested atomic() blocks create savepoints. Exceptions in nested blocks must be caught to prevent rolling back the parent block: async with atomic() as sp1: await User.create(name="Bob") try: async with atomic() as sp2: await Post.create(title="Hello") raise ValueError("nested exception") # sp2 rolls back here except ValueError: pass # Exception is caught; sp1 remains active and uncompromised # Bob will be saved, Post will be rolled back Atomic & Contexts Lifecycle Hooks )
Go to Homepage