Skip to content

feat: add --validate mode to check CSV syntax without running a query#130

Merged
vmvarela merged 3 commits intomasterfrom
issue-88/add-validate-flag
May 7, 2026
Merged

feat: add --validate mode to check CSV syntax without running a query#130
vmvarela merged 3 commits intomasterfrom
issue-88/add-validate-flag

Conversation

@vmvarela
Copy link
Copy Markdown
Owner

@vmvarela vmvarela commented May 7, 2026

Summary

  • Adds --validate flag that parses the entire CSV/TSV input without executing any SQL query
  • On success prints OK: <n> rows, <m> columns (<col> <TYPE>, ...) to stdout and exits 0
  • On CSV parse error prints the existing error message (row number + description) and exits 2
  • Compatible with --delimiter, --tsv, --no-type-inference
  • Mutually exclusive with a query argument

Changes

  • src/main.zig: new ValidateArgs struct, validate variant in ArgsResult, ValidateWithQuery error, full runValidate() implementation with type inference, thousands-separated row count, and column type summary
  • build.zig: 4 new integration tests (75–78) — valid CSV, malformed CSV exits 2, custom delimiter, conflict with query
  • README.md: new row in the flags table for --validate
  • docs/sql-pipe.1.scd: new *--validate* entry in OPTIONS section

Acceptance Criteria

  • --validate parses the entire CSV input and prints a summary to stdout on success: OK: <n> rows, <m> columns (<col> <TYPE>, ...)
  • On parse error, print the existing CSV error message (row number + description) and exit 2
  • --validate does not run any SQL query — no query argument required or used
  • Works with --delimiter, --tsv, --no-type-inference
  • Exit 0 on success, exit 2 on CSV error
  • Documented in --help, README.md, and docs/sql-pipe.1.scd
  • Tests: valid CSV exits 0 with correct summary; malformed CSV exits 2 with row number

Closes #88

@vmvarela vmvarela added priority:medium Should be done soon size:s Small — 1 to 4 hours type:feature New functionality labels May 7, 2026
@github-actions github-actions Bot removed the type:feature New functionality label May 7, 2026
@vmvarela vmvarela merged commit ef8c6f0 into master May 7, 2026
4 checks passed
@vmvarela vmvarela deleted the issue-88/add-validate-flag branch May 7, 2026 11:08
@vmvarela vmvarela added the type:feature New functionality label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Should be done soon size:s Small — 1 to 4 hours type:feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --validate mode to check input syntax without running a query

1 participant