Spaces:
Paused

miracle / scratch /check_users_ws.py
dushyantsingh0
backend stabilization
35400d1
Raw History Blame Contribute Delete
673 Bytes
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())