Spaces:
Paused
Paused
Download scratch/check_users.py from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 684 Bytes
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/check_users.py
- Command line
-
hf download hf://spaces/3SCError404/miracle/scratch/check_users.py
-
curl -L -o check_users.py https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/check_users.py
684 Bytes
| import sys | |
| sys.path.append('.') | |
| import asyncio | |
| if sys.platform == 'win32': | |
| asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) | |
| from core.database import async_session_factory | |
| from models.user import User | |
| from models.user_workspace import UserWorkspace | |
| from sqlalchemy import select | |
| async def main(): | |
| async with async_session_factory() as db: | |
| stmt = select(User.full_name, User.global_role, UserWorkspace.workspace_id, UserWorkspace.role).outerjoin(UserWorkspace, User.id == UserWorkspace.user_id) | |
| result = await db.execute(stmt) | |
| for row in result.all(): | |
| print(row) | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |