Database — current state¶
Version: 0.2 · Last Updated: 2026-09-08 · Status: 🔴 evidence refreshed; design ratification unchanged
Verified against source revision 2465fcc (develop baseline). Test references
below identify the executable contracts; they are not a new coverage percentage.
Mounted database handlers¶
The recipe's database names db_class and optionally db_handler_class.
AsgiServer._register_configured_databases builds the database from resolved
parameters, wraps it in the handler (default AsgiDbHandlerBase) and registers
it by code. Duplicate codes raise ValueError. Concrete backends remain
consumer code.
AsgiDbHandlerBase delegates non-private attributes and calls the wrapped
closeConnection when present. Request.db resolves the application's
db_name or default, caches the handler and registers cleanup on the current
request item. get_db(name) performs lookup without registering that cleanup.
Thread-affine consumer cleanup is separately available in
RoutedApplication.route_cleanup.
Claim anchors: db, AsgiServer, _register_configured_databases, AsgiDbHandlerBase, closeConnection, Request, db_name, get_db, RoutedApplication, route_cleanup.