Add asyncpg postgresdb driver. Better synergy with fastapi and has better performance (see the benchmark on asyncpg 's readme)
We're maintaining backward compatibility by keeping the sync sqlmodel engine
Adopted async db sessions across all services and routers
Add pytest fixture to share single event loop across a test session. This was causing a bug where a future was awaited on a different event loop (i.e. the event loop changed)
Added deduplication for ValidationResult objects
Known issues
DB connection and session is sensitive to the event loop, as the connection pool is a global var.
There are issues with how pytest handles async-marked tests. We've used the fixture to share the same event loop over all the tests, however in the FastAPI lifespan we cannot switch out the sync initialization to async. This breaks pytest. I suspect that its because initializing the engine async creates the db connection pool thread-locally to some event loop that's different from the one pytest creates.
Features
asyncpg
postgresdb driver. Better synergy with fastapi and has better performance (see the benchmark onasyncpg
's readme)ValidationResult
objectsKnown issues
Testing