Skip to content

v3.3.0

Compare
Choose a tag to compare
@aloeci aloeci released this 11 Jun 13:47
· 20 commits to master since this release

Feature

  • Added FastAPI Async Context Manager integration (DIA-69117) (1c87d08)

Deprecation

  • fastapi_sqla.setup function 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)