TIF_E41253310/scripts/checks/check_db_per_year.py

11 lines
360 B
Python

import sys
sys.path.append('Backend')
from app.config.database import engine
from sqlalchemy import text
with engine.connect() as conn:
rows = conn.execute(text("SELECT tahun_lulus, COUNT(*) FROM alumni GROUP BY tahun_lulus ORDER BY tahun_lulus;")).fetchall()
print("Alumni in DB per year:")
for r in rows:
print(f" {r[0]}: {r[1]} rows")