Spaces:
Running

microfunnel-api / backend /list_tenants_debug.py
axeronis
feat: Implement LinkedIn Integration (Messaging + Polling) and enhance Webhook
e4d238f
Raw History Blame Contribute Delete
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())