Spaces:
Running
Running
AI Assistant
feat: add scripts for bulk invoice data insertion and database entity inspection
c31e90d Download test_query.py from amirelrefai/ERP_Sysyem: direct link, hf CLI and curl.
- Browser
- Download file 872 Bytes
-
https://huggingface.co/spaces/amirelrefai/ERP_Sysyem/resolve/main/test_query.py
- Command line
-
hf download hf://spaces/amirelrefai/ERP_Sysyem/test_query.py
-
curl -L -o test_query.py https://huggingface.co/spaces/amirelrefai/ERP_Sysyem/resolve/main/test_query.py
872 Bytes
| import sys | |
| from app.core.database import SessionLocal | |
| from app.models.domain import User, Tenant, Product, Party | |
| from sqlalchemy import select | |
| def main(): | |
| with SessionLocal() as db: | |
| users = db.execute(select(User)).scalars().all() | |
| print("Users:", [{"id": u.id, "email": u.email, "tenant_id": u.tenant_id} for u in users]) | |
| tenants = db.execute(select(Tenant)).scalars().all() | |
| print("Tenants:", [{"id": t.id, "name": t.name} for t in tenants]) | |
| products = db.execute(select(Product)).scalars().all() | |
| print("Products:", [{"id": p.id, "name": p.name, "tenant_id": p.tenant_id} for p in products]) | |
| parties = db.execute(select(Party)).scalars().all() | |
| print("Parties:", [{"id": p.id, "name": p.name, "tenant_id": p.tenant_id} for p in parties]) | |
| if __name__ == "__main__": | |
| main() | |