Files
service-finder/tests/archive/check_db.py.old

17 lines
545 B
Python

import asyncio
from sqlalchemy import select
from app.db.session import AsyncSessionLocal
from app.models.identity import User
from app.models.marketplace.organization import Organization
async def check():
async with AsyncSessionLocal() as db:
u = (await db.execute(select(User).limit(5))).scalars().all()
o = (await db.execute(select(Organization).limit(5))).scalars().all()
print(f"Users: {len(u)}")
print(f"Orgs: {len(o)}")
if u: print(u[0].id)
if o: print(o[0].id)
asyncio.run(check())