Spaces:
Paused
Paused
Download scratch/check_users_ws.py from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 673 Bytes
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/check_users_ws.py
- Command line
-
hf download hf://spaces/3SCError404/miracle/scratch/check_users_ws.py
-
curl -L -o check_users_ws.py https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/check_users_ws.py
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()) | |