made fastapi tools

This commit is contained in:
2026-06-12 14:45:10 -04:00
parent c5418b50fd
commit 479191050e
6 changed files with 10 additions and 4 deletions
+16
View File
@@ -0,0 +1,16 @@
"""FastAPI dependencies."""
from collections.abc import Iterator
from typing import Annotated
from fastapi import Depends, Request
from sqlalchemy.orm import Session
def get_db(request: Request) -> Iterator[Session]:
"""Get database session from app state."""
with Session(request.app.state.engine) as session:
yield session
DbSession = Annotated[Session, Depends(get_db)]