v3.3.0
Feature
- Added FastAPI Async Context Manager integration (DIA-69117) (
1c87d08)
Deprecation
fastapi_sqla.setupfunction is deprecated due to the deprecation of FastAPI Lifespan Events. It will be removed in upcoming releases. Please refer to the migration section for updating your codebase.
Migration
To integrate the library with FastAPI using Async Context Manager, replace the previous setup function with startup and setup_middlewares.
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi_sqla import Base, Item, Page, Paginate, Session, setup_middlewares, startup
@asynccontextmanager
async def lifespan(app: FastAPI):
await startup()
yield
app = FastAPI(lifespan=lifespan)
setup_middlewares(app)