| """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) | |