DocWeave / backend /list_checkpoint_threads.py
shak3008's picture
feat: complete end-to-end platform with all standout behaviors
fcacf10
Raw
History Blame Contribute Delete
568 Bytes
import psycopg
from app.core.config import DATABASE_URL
conn = psycopg.connect(DATABASE_URL)
try:
cur = conn.cursor()
cur.execute("""
SELECT thread_id, COUNT(*)
FROM checkpoints
GROUP BY thread_id
ORDER BY COUNT(*) DESC
""")
rows = cur.fetchall()
print("=" * 60)
print("LANGGRAPH CHECKPOINT THREADS")
print("=" * 60)
if not rows:
print("NO CHECKPOINTS FOUND")
else:
for thread_id, count in rows:
print(thread_id, "CHECKPOINTS:", count)
finally:
conn.close()