File size: 1,243 Bytes
f92be26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import asyncio
from core.database import engine
from sqlalchemy import select
from models.impact import ImpactMapping
from models.policy import Policy
from models.regulation import Regulation
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import sessionmaker

async def check_data():
    async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
    async with async_session() as session:
        # Check Impact Mappings
        res = await session.execute(select(ImpactMapping))
        mappings = res.scalars().all()
        print(f"Total Impact Mappings: {len(mappings)}")
        
        # Check Policies
        res = await session.execute(select(Policy))
        policies = res.scalars().all()
        print(f"Total Policies: {len(policies)}")
        
        # Check Regulations
        res = await session.execute(select(Regulation))
        regs = res.scalars().all()
        print(f"Total Regulations: {len(regs)}")

        for m in mappings:
            print(f"Mapping: RegID={m.regulation_id}, PolID={m.policy_id}, Status={m.status}, Level={m.impact_level}")

if __name__ == "__main__":
    import os
    import sys
    sys.path.insert(0, os.getcwd())
    asyncio.run(check_data())