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