Skip to content

Conversation

@mghh
Copy link

@mghh mghh commented Jan 30, 2023

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:

- 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant