Spaces:
Paused

File size: 804 Bytes
630aa02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import asyncio
from core.database import async_session_factory
from models.user import User
from models.ticket import Ticket
from sqlalchemy import select

async def run():
    async with async_session_factory() as db:
        # Get users
        res = await db.execute(select(User))
        users = res.scalars().all()
        print(f"Total Users: {len(users)}")
        for u in users:
            print(f"  {u.email} | Role: {u._legacy_role} | WS: {u._legacy_workspace_id}")
        
        # Get tickets
        res = await db.execute(select(Ticket))
        tickets = res.scalars().all()
        print(f"Total Tickets: {len(tickets)}")
        for t in tickets:
            print(f"  {t.title} | WS: {t.workspace_id} | CreatedBy: {t.created_by}")

if __name__ == "__main__":
    asyncio.run(run())