Spaces:
Paused

miracle / scratch /list_workspaces.py
dushyantsingh0
backend stabilization
1c7bba3
Raw History Blame Contribute Delete
550 Bytes
import asyncio
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
from core.database import async_session_factory
from sqlalchemy import text
async def check():
try:
async with async_session_factory() as db:
res = await db.execute(text("SELECT id, name FROM workspaces"))
for r in res:
print(f"ID: {r[0]} | Name: {r[1]}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
asyncio.run(check())