-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_db.py
More file actions
28 lines (22 loc) · 794 Bytes
/
check_db.py
File metadata and controls
28 lines (22 loc) · 794 Bytes
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
import os
import psycopg2
# Get database URL
db_url = os.environ['DATABASE_URL']
print(f"Using database: {db_url[:50]}...")
try:
# Connect directly with psycopg2
conn = psycopg2.connect(db_url)
cur = conn.cursor()
# Check stats
print("\n=== Database Stats ===")
cur.execute("SELECT config_name, COUNT(*) FROM results GROUP BY config_name;")
for row in cur.fetchall():
print(f"{row[0]}: {row[1]} results")
print("\n=== Score Ranges ===")
cur.execute("SELECT config_name, MIN(reference_index), MAX(reference_index) FROM results GROUP BY config_name;")
for row in cur.fetchall():
print(f"{row[0]}: {row[1]:.1f} - {row[2]:.1f}")
conn.close()
print("\n✅ Database check complete")
except Exception as e:
print(f"Error: {e}")