Skip to content

Commit 888de66

Browse files
suryaiyer95claude
andcommitted
fix: detect SQL execution errors in _execute_task before passing to diff engine
When `execute_sql` fails, it returns `columns=['error']` with the error message as a data row. Previously this was silently passed to the Rust engine as data, causing confusing downstream failures. Now raises `RuntimeError` immediately so the error propagates to the user. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d74d30c commit 888de66

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/altimate-engine/src/altimate_engine/sql

packages/altimate-engine/src/altimate_engine/sql/data_diff.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def _execute_task(task: dict, warehouse: str) -> dict:
5555
SqlExecuteParams(sql=task["sql"], warehouse=warehouse, limit=100_000)
5656
)
5757

58+
# Detect error results: execute_sql returns columns=['error'] on failure
59+
if result.columns and result.columns[0] == "error":
60+
error_msg = result.rows[0][0] if result.rows else "Unknown SQL execution error"
61+
raise RuntimeError(f"SQL execution failed for task {task['id']}: {error_msg}")
62+
5863
# Convert SqlExecuteResult rows to the format expected by ReladiffSession.step()
5964
# Guard: executor returns a synthetic status row when row_count is 0 — skip it.
6065
rows: list[list[str | None]] = []

0 commit comments

Comments
 (0)