19 lines
750 B
Python
19 lines
750 B
Python
import asyncio
|
|
from sqlmodel import create_engine, select, Session
|
|
import sys
|
|
sys.path.append('backend')
|
|
import models
|
|
|
|
DATABASE_URL = "postgresql://pragativeer_admin:local_secure_password_2026@postgres:5432/pragativeer_prod"
|
|
engine = create_engine(DATABASE_URL)
|
|
|
|
with Session(engine) as session:
|
|
user = session.exec(select(models.User).where(models.User.name == "Amit Kumar")).first()
|
|
print(f"User: {user.name}, Tier: {user.tier}, Exam: {user.target_exam}")
|
|
|
|
query = select(models.Test).where(models.Test.is_active == True).where(models.Test.type != "DPS")
|
|
tests = session.exec(query).all()
|
|
print(f"Tests returned from DB (excluding DPS): {len(tests)}")
|
|
for t in tests:
|
|
print(f" - {t.title} ({t.exam_pattern})")
|