Spaces:
Paused
Paused
Download scripts/create_diag_project.py from 3SCError404/nexus: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/3SCError404/nexus/resolve/main/scripts/create_diag_project.py
- Command line
-
hf download hf://spaces/3SCError404/nexus/scripts/create_diag_project.py
-
curl -L -o create_diag_project.py https://huggingface.co/spaces/3SCError404/nexus/resolve/main/scripts/create_diag_project.py
1.38 kB
| import asyncio | |
| from core.database import async_session_factory | |
| from models.workspace import Workspace | |
| from models.project import Project | |
| from sqlalchemy import select | |
| async def create_diagnostic_project(): | |
| async with async_session_factory() as db: | |
| # 1. Find Acme Workspace | |
| ws_result = await db.execute(select(Workspace).where(Workspace.name == "Acme Corp")) | |
| ws = ws_result.scalar_one_or_none() | |
| if not ws: | |
| # Fallback to any workspace | |
| ws_result = await db.execute(select(Workspace).limit(1)) | |
| ws = ws_result.scalar_one_or_none() | |
| if not ws: | |
| print("ERROR: No workspace found. Please run seed.py first.") | |
| return | |
| # 2. Create Project | |
| project = Project( | |
| name="Nexus Many-to-Many Launch", | |
| description="Diagnostic project to verify context-aware lookup and global visibility.", | |
| status="active", | |
| workspace_id=ws.id | |
| ) | |
| db.add(project) | |
| await db.commit() | |
| await db.refresh(project) | |
| print("\n--- Project Created Successfully ---") | |
| print(f"PROJECT_ID: {project.id}") | |
| print(f"WORKSPACE: {ws.name} ({ws.id})") | |
| print("------------------------------------\n") | |
| if __name__ == "__main__": | |
| asyncio.run(create_diagnostic_project()) | |