18 lines
304 B
Python
18 lines
304 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)
|
|
]
|
|
|