Skip to content

Encode/Databases 0.8.0 breaks fastapi-complete tests #4

@andredias

Description

@andredias

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions