DocWeave / backend /inspect_checkpoint_workflows.py
shak3008's picture
feat: complete end-to-end platform with all standout behaviors
fcacf10
Raw
History Blame Contribute Delete
744 Bytes
import psycopg
from app.core.config import DATABASE_URL
conn = psycopg.connect(DATABASE_URL)
try:
cur = conn.cursor()
cur.execute("""
SELECT
wr.id,
wr.status,
wr.document_version_id
FROM workflow_runs wr
WHERE wr.id IN (
SELECT DISTINCT thread_id::uuid
FROM checkpoints
)
ORDER BY wr.status, wr.id
""")
rows = cur.fetchall()
print("=" * 70)
print("CHECKPOINT-BACKED WORKFLOWS")
print("=" * 70)
for workflow_id, status, version_id in rows:
print()
print("WORKFLOW:", workflow_id)
print("STATUS:", status)
print("DOCUMENT VERSION:", version_id)
finally:
conn.close()