/format

Reformat SQL: keywords uppercased, canonical indentation. Pure string rewrite; offline.

Category: slash-commands

Syntax

/format <sql>

Description

## Overview `/format` parses the argument SQL with the embedded delta-forge-toolkit parser, then rewrites it using the canonical formatter: keywords uppercased, clauses broken onto separate lines, arguments aligned. The command is offline; it uses only code linked into the CLI binary. ## Behavior - Input must parse cleanly. If parsing fails, the card shows a parse error at line and column, the same format as `/validate` would produce. The formatter does not attempt to rewrite broken SQL. - Output reflects the formatter's opinions: two-space indentation, one clause per line, commas at end of line, function and data-type keywords uppercased. - The command prints the reformatted text; it does not write to a file. Use shell piping or `/export` after running to persist the result. - Multi-statement scripts are supported: each statement is reformatted, and the output preserves the original semicolon separation.

Examples

/format select id, name from customers where active=true
/format merge into t using s on t.id=s.id when matched then update set t.v=s.v when not matched then insert (id,v) values(s.id,s.v)
/format CREATE TABLE sales.orders (id INT, total DECIMAL(18,2)) USING DELTA

See Also

Open in interactive docs →   DeltaForge home →