analyst-buddy / server /synthetic /validate.py
hjerpe's picture
F006/F008: serve Qwen models + model switcher (vanilla-first)
656f91e verified
Raw
History Blame Contribute Delete
548 Bytes
"""Validation helpers for synthetic database variants."""
from __future__ import annotations
import sqlite3
def validate_gold_sql(
db_path: str,
gold_sql: str,
timeout: float = 5.0,
) -> tuple[bool, str | None]:
"""Run gold SQL and report whether it returns a non-empty result set."""
with sqlite3.connect(db_path, timeout=timeout) as connection:
cursor = connection.cursor()
cursor.execute(gold_sql)
rows = cursor.fetchall()
if not rows:
return False, None
return True, str(rows)