SPB Git

spb/findata

Public

sandbox: accept EXPLAIN; assistant test green (37 tests)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed (Nov 1, 2026) parent 8aa539b Browse files

1 changed file +2 −1

Unified Split
modified services/ingest/src/findata_ingest/reader.py +2 −1
@@ -122,8 +122,9 @@ def run_sql(sql: str, max_rows: int, timeout_s: int, views: dict[str, list[str]]
122 forbidden = re.compile(r"\b(attach|copy|export|import|install|load|create|insert|update|delete|drop|alter|pragma|set|call|read_csv|read_json|read_text|glob|httpfs)\b", re.IGNORECASE) 122 forbidden = re.compile(r"\b(attach|copy|export|import|install|load|create|insert|update|delete|drop|alter|pragma|set|call|read_csv|read_json|read_text|glob|httpfs)\b", re.IGNORECASE)
123 if forbidden.search(sql) or ";" in sql.strip().rstrip(";"): 123 if forbidden.search(sql) or ";" in sql.strip().rstrip(";"):
124 raise ValueError("only a single read-only SELECT statement is allowed") 124 raise ValueError("only a single read-only SELECT statement is allowed")
125− if not re.match(r"^\s*(select|with|describe|show|summarize)\b", sql, re.IGNORECASE): 125+ if not re.match(r"^\s*(select|with|describe|show|summarize|explain)\b", sql, re.IGNORECASE):
126 raise ValueError("statement must start with SELECT / WITH") 126 raise ValueError("statement must start with SELECT / WITH")
127+ is_explain = bool(re.match(r"^\s*explain\b", sql, re.I))
127 con = _con() 128 con = _con()
128 lake_root = str(Lake().root).replace("'", "''") 129 lake_root = str(Lake().root).replace("'", "''")
129 con.execute(f"SET allowed_directories = ['{lake_root}/curated', '{lake_root}/_retired']") 130 con.execute(f"SET allowed_directories = ['{lake_root}/curated', '{lake_root}/_retired']")
130 131
Menu

Theme