Spaces:
Paused

File size: 550 Bytes
1c7bba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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())