Spaces:
Running
Running
Download backend/list_tenants_debug.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/list_tenants_debug.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/list_tenants_debug.py
-
curl -L -o list_tenants_debug.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/list_tenants_debug.py
813 Bytes
| import sys | |
| import os | |
| # Create absolute path to backend directory | |
| BACKEND_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| if BACKEND_DIR not in sys.path: | |
| sys.path.insert(0, BACKEND_DIR) | |
| from sqlalchemy import text | |
| from app.db.session import async_session_maker | |
| from app.core.config import settings | |
| async def list_tenants(): | |
| async with async_session_maker() as session: | |
| result = await session.execute(text("SELECT id, name, business_name FROM tenants")) | |
| tenants = result.fetchall() | |
| print(f"Found {len(tenants)} tenants:") | |
| for t in tenants: | |
| print(f"ID: {t[0]} | Name: {t[1]} | Business: {t[2]}") | |
| if __name__ == "__main__": | |
| if os.name == 'nt': | |
| asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) | |
| asyncio.run(list_tenants()) | |