import asyncio from sqlalchemy import select from app.db.session import AsyncSessionLocal from app.models.marketplace.organization import Branch async def check(): async with AsyncSessionLocal() as db: o = (await db.execute(select(Branch).limit(5))).scalars().all() for i in o: print(i.id, i.organization_id, i.is_main) asyncio.run(check())