Lifecycle Hooks — Aquilia Documentation
Comprehensive guide and documentation for Lifecycle Hooks in the Aquilia framework. View API reference, examples, and implementation patterns.
Docs / Models / Transaction Hooks Transaction Hooks Register post-commit or post-rollback hook callbacks safely. Registering Callbacks Both sync and async callables are supported. on_commit hooks only fire when the outermost transaction successfully commits: async with atomic() as txn: await Order.create(total=100) # Commit callback (outermost only) txn.on_commit(lambda: send_email("order confirmed")) # Rollback callback txn.on_rollback(lambda: log_failure("order failed")) Execution Safety & Isolation Hooks are isolated: if one hook fails and raises an exception, the exception is logged but suppressed. This ensures that a single failed hook callback does not interrupt other registered hooks or corrupt already-completed database actions. Savepoints & Nesting Signals )
Go to Homepage