15 lines
282 B
Python
15 lines
282 B
Python
from typing import Annotated
|
|
|
|
from fastapi import Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from database import engine
|
|
|
|
|
|
def get_session():
|
|
with Session(engine, expire_on_commit=False) as session:
|
|
yield session
|
|
|
|
|
|
SessionDep = Annotated[Session, Depends(get_session)]
|