import asyncio from sqlalchemy import text from app.db.session import AsyncSessionLocal async def main(): async with AsyncSessionLocal() as session: print("--- TASK 1: BRANCHES (GARAGES) ---") try: result = await session.execute(text("SELECT id, organization_id, name FROM fleet.branches;")) branches = result.fetchall() print("| id | organization_id | name |") print("|---|---|---|") for b in branches: print(f"| {b.id} | {b.organization_id} | {b.name} |") except Exception as e: print(f"Error querying fleet.branches: {e}") print("\n--- TASK 2: ASSETS (VEHICLES) ---") try: # We will query all assets and print the relevant columns. result = await session.execute(text("SELECT id, license_plate, owner_person_id, owner_org_id, branch_id FROM vehicle.assets LIMIT 50;")) assets = result.fetchall() print("| id | license_plate | owner_person_id | owner_org_id | branch_id |") print("|---|---|---|---|---|") for a in assets: print(f"| {a.id} | {a.license_plate} | {a.owner_person_id} | {a.owner_org_id} | {a.branch_id} |") except Exception as e: print(f"Error querying vehicle.assets: {e}") if __name__ == "__main__": asyncio.run(main())