
import asyncio
from sqlalchemy import select, func
from database import get_async_session, Job

async def count_jobs():
    async for session in get_async_session():  # get_async_session возвращает async generator
        result = await session.execute(select(func.count()).select_from(Job))
        count = result.scalar_one()
        print(f"Всего записей: {count}")

asyncio.run(count_jobs())

