sqlchisel formats SQL files or stdin with ANSI and Dremio dialect support.
Only one of these may be selected at a time:
--format: format input and print to stdout--check: compare formatted output to input; exits1if any input would change--write: rewrite files in place
If none of the mode flags are provided, sqlchisel currently passes input through unchanged.
- File inputs:
sqlchisel --format path/to/file.sql - Stdin input:
cat query.sql | sqlchisel --stdin --format
Constraints:
- Use either file paths or
--stdin, not both. --writerequires file inputs and cannot be combined with--stdin.- At least one input source is required.
--dialect <ansi|dremio>--keyword-case <upper|lower|capitalize>--line-length <N>--indent-width <N>--select-list-style <auto|per_line>--strict(fail on parse errors instead of raw fallback)--config <PATH>(explicit config file)--include <GLOB>/--exclude <GLOB>(directory recursion filters)--debug-parse(print parsed AST/debug metadata)
When a provided path is a directory, sqlchisel recursively collects matching files.
- Default include glob:
**/*.sql --includeoverrides the default include list--excludefilters paths out- Ignored directories during recursion:
.git,target,.cargo - Symlinks are skipped
- Success: exit
0 --checkwith any file needing changes: exit1- Invalid CLI combinations, parse failures in strict mode, read/write errors, and other runtime failures return non-zero errors
See format-contract.md for stable behavior expectations around formatting output.