Spaces:
Paused

File size: 673 Bytes
35400d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import asyncio
import sys
import os

# Ensure the project root is in path
sys.path.append(os.getcwd())

from core.database import async_session_factory
from models.user import User
from sqlalchemy import select

async def check():
    async with async_session_factory() as db:
        res = await db.execute(select(User))
        users = res.scalars().all()
        print(f"Total Users: {len(users)}")
        for u in users:
            print(f"- Email: {u.email}, WS_ID: {u.workspace_id}, Role: {u.role}")

if __name__ == "__main__":
    if sys.platform == 'win32':
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
    asyncio.run(check())