from typing import Annotated

from fastapi.params import Depends
from sqlalchemy import create_engine
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import Session
import os


DB_URL = os.environ['DB_URL_CONFIG']

session_engine = create_engine(DB_URL)

def get_db_session():
    with Session(session_engine) as session:
        yield session

DBSessionDep = Annotated[AsyncSession, Depends(get_db_session)]