Skip to content

CLI Reference

SQLFluff provides a comprehensive command-line interface for linting, fixing, and parsing SQL files.

Available Commands

CommandDescription
dialectsShow the current dialects available.
fixFix SQL files. PATH is the path to a sql file or directory to lint. This can be either a file (path/to/file.sql), a path (directory/of/sql/files), a single (-) character to indicate reading from stdin or a dot/blank (./) which will be interpreted like passing the current working directory as a path argument.
formatAutoformat SQL files. This effectively force applies sqlfluff fix with a known subset of fairly stable rules. Enabled rules are ignored, but rule exclusions (via CLI) or config are still respected. PATH is the path to a sql file or directory to lint. This can be either a file (path/to/file.sql), a path (directory/of/sql/files), a single (-) character to indicate reading from stdin or a dot/blank (./) which will be interpreted like passing the current working directory as a path argument.
lintLint SQL files via passing a list of files or using stdin. PATH is the path to a sql file or directory to lint. This can be either a file (path/to/file.sql), a path (directory/of/sql/files), a single (-) character to indicate reading from stdin or a dot/blank (./) which will be interpreted like passing the current working directory as a path argument. Linting SQL files: sqlfluff lint path/to/file.sql sqlfluff lint directory/of/sql/files Linting a file via stdin (note the lone - character): cat path/to/file.sql
parseParse SQL files and just spit out the result. PATH is the path to a sql file or directory to lint. This can be either a file (path/to/file.sql), a path (directory/of/sql/files), a single (-) character to indicate reading from stdin or a dot/blank (./) which will be interpreted like passing the current working directory as a path argument.
renderRender SQL files and just spit out the result. PATH is the path to a sql file. This should be either a single file file (path/to/file.sql) or a single (-) character to indicate reading from stdin.
rulesShow the current rules in use.
versionShow the version of sqlfluff.

Quick Start

bash
# Lint SQL files
sqlfluff lint path/to/file.sql

# Fix violations automatically
sqlfluff fix path/to/file.sql

# Check available dialects
sqlfluff dialects

Released under the MIT License.