Description
Add a --null-value flag that controls how NULL values are rendered in output.
# Default behavior (empty for CSV, null for JSON):
sql-pipe data.csv 'SELECT * FROM t'
# Custom NULL representation:
sql-pipe data.csv --null-value 'N/A' 'SELECT * FROM t'
sql-pipe data.csv --null-value '' 'SELECT * FROM t'
sql-pipe data.csv --null-value '-' 'SELECT * FROM t'
Motivation
Different tools and consumers expect different NULL representations. Some CSV consumers treat empty strings as NULL, others treat the literal string "NULL" as NULL. This flag gives users control over how missing data is represented in the output.
Acceptance Criteria
Implementation Notes
- In
format.zig's csvPrintRow (~line 236), replace the hardcoded empty/NULL with the configured value
- In
json_mod.printJsonRow (~line 437), decide whether to respect the flag or keep JSON null
- Add
null_value: ?[]const u8 field to ParsedArgs
Description
Add a
--null-valueflag that controls how NULL values are rendered in output.Motivation
Different tools and consumers expect different NULL representations. Some CSV consumers treat empty strings as NULL, others treat the literal string "NULL" as NULL. This flag gives users control over how missing data is represented in the output.
Acceptance Criteria
--null-value <string>flag is parsed inargs.zig--null-valueis ignored (JSONnullis semantically correct) or produces a warningImplementation Notes
format.zig'scsvPrintRow(~line 236), replace the hardcoded empty/NULL with the configured valuejson_mod.printJsonRow(~line 437), decide whether to respect the flag or keep JSONnullnull_value: ?[]const u8field toParsedArgs