import asyncio from sqlalchemy import select from app.db.session import AsyncSessionLocal from app.models.vehicle.asset import Asset async def check(): async with AsyncSessionLocal() as db: a = (await db.execute(select(Asset).where(Asset.license_plate == "TEST-888"))).scalar() if a: print("TEST-888 db branch_id:", a.branch_id) print("TEST-888 db catalog_id:", a.catalog_id) a2 = (await db.execute(select(Asset).where(Asset.license_plate == "DRAFT-888"))).scalar() if a2: print("DRAFT-888 db branch_id:", a2.branch_id) asyncio.run(check())