By default fastapi handles HTTPExceptions and does not raise inside the fastapi-sqlalchemy middleware. We introduce two new parameters to control rollback behaviour:
rollback_on_client_error rolls back on 40x http exceptions
rollback_on_server_error rolls back on 50x http exceptions
Additional we add support to force rollback if used outside a route in context manager by setting the attribute
force_rollback on the session context (see tests/test_session.py).
By default fastapi handles HTTPExceptions and does not raise inside the fastapi-sqlalchemy middleware. We introduce two new parameters to control rollback behaviour:
Additional we add support to force rollback if used outside a route in context manager by setting the attribute
force_rollback
on the session context (see tests/test_session.py).