Spaces:
Paused

miracle / scratch /list_rules.py
dushyantsingh0
backend stabilisation
cde49b7
Raw History Blame Contribute Delete
643 Bytes
import asyncio
import os
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
sys.path.append(os.getcwd())
from sqlalchemy import select
from core.database import async_session_factory
from models.escalation_rule import EscalationRule
async def list_rules():
async with async_session_factory() as db:
res = await db.execute(select(EscalationRule))
for r in res.scalars().all():
print(f"WS: {r.workspace_id} | Name: {r.name} | Level: {r.priority_level} | Thresh: {r.threshold_minutes}")
if __name__ == '__main__':
asyncio.run(list_rules())