-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
priority:mediumShould be done soonShould be done soonsize:xsTrivial — less than 1 hourTrivial — less than 1 hourstatus:readyRefined and ready for sprint selectionRefined and ready for sprint selectiontype:featureNew functionalityNew functionality
Milestone
Description
Description
sql-pipe currently writes results only to stdout. In automation scripts or when building pipelines with multiple steps, users often want to write results directly to a file without shell redirection. A --output flag makes the intent explicit and avoids accidental overwrites common with >.
Example
# Without --output (works but fragile in scripts)
sql-pipe 'SELECT * FROM t' < input.csv > results.csv
# With --output (explicit, safer)
cat input.csv | sql-pipe --output results.csv 'SELECT * FROM t'
# Combining with --json
cat input.csv | sql-pipe --json --output report.json 'SELECT region, SUM(revenue) FROM t GROUP BY region'Acceptance Criteria
-
--output <path>writes stdout to the given file path, creating or overwriting it - If the file cannot be created (bad path, permissions), exit with code 1 and a clear error message
- Without
--output, behaviour is unchanged (write to stdout) - Compatible with all output modes: CSV (default),
--json,--header - Documented in
--help, README.md Flags table, anddocs/sql-pipe.1.scd - Test: output written to file, file contains correct content, missing parent directory error handled
Notes
- Implementation: open file before query execution, pass writer to
execQuery - Atomic write (write to temp file, rename) is a nice-to-have but not required for v1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority:mediumShould be done soonShould be done soonsize:xsTrivial — less than 1 hourTrivial — less than 1 hourstatus:readyRefined and ready for sprint selectionRefined and ready for sprint selectiontype:featureNew functionalityNew functionality