from contextlib import AbstractContextManager from typing import Iterable from dependency_injector.providers import Callable from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker from sqlalchemy.orm import Session from api.model.user import User class UowBase: def __init__( self, session_factory, ) -> None: self.session = session_factory async def get_all_users(self): async with self.session as s: query = select(User) rr = await s.execute(query) return rr.scalars().all()