Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode/Databases 0.8.0 breaks fastapi-complete tests #4

Open
andredias opened this issue Sep 10, 2023 · 1 comment
Open

Encode/Databases 0.8.0 breaks fastapi-complete tests #4

andredias opened this issue Sep 10, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@andredias
Copy link
Owner

According to 0.8.0 release notes:

This release improves isolation of connections and transactions across concurrent tasks:

  • Database connections are now task-local and are not inherited by child tasks
  • The @db.transaction decorator uses the calling task's connection
  • Each new task uses a new connection unless a connection is explicitly provided

These changes improve the consistency of behavior and fix bugs where connections and transactions were not properly isolated such as: encode/databases#123, encode/databases#125, encode/databases#134, encode/databases#155, encode/databases#424, and encode/databases#452.

In most cases, these changes should not be breaking. However, if using an open transaction across tasks, the active connection (db.connection()) now needs to be explicitly passed to each task. See the new documentation for an example.

Those changes break the app fixture which wraps the app with a db.transaction(force_rollback=True): to roll back all changes made during testing.

@andredias andredias self-assigned this Sep 10, 2023
@andredias andredias added the bug Something isn't working label Sep 10, 2023
@andredias
Copy link
Owner Author

encode/databases#546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant