2025-05-26 18:34:58 +00:00

15 lines
265 B
Python

from typing import Generator
from app.db.session import SessionLocal
def get_db() -> Generator:
"""
Get a database session for use in FastAPI dependency injection.
"""
db = SessionLocal()
try:
yield db
finally:
db.close()