fix(cli): preserve raw text when SQL results contain pipes or newlines (#13432)

Merged
DW
1mo ago
+75-7

Fixes #13432

Summary

Prevents silent data truncation and table corruption when omi --json local sql receives query results containing pipe (|) delimiters or multiline text cells.

Changes Made

  • Updated _normalize_sql_result in sdks/python-cli/omi_cli/commands/local.py to verify that the parsed row count matches expected_count from the footer and that every line splits into exactly len(columns) values. If a line contains extra pipe delimiters or multiline text, _normalize_sql_result falls back to {"text": result} to preserve raw text without discarding data.
  • Added regression tests in sdks/python-cli/tests/test_local.py validating raw text fallback when single-column output contains pipe characters or multiline strings.

Verification

  • Executed uv run pytest tests/test_local.py (49 passed).
  • Executed full test suite uv run pytest (372 passed).