Overview of SQL Linting and Formatting
includes
paths will be linted.sdf lint
to lint sql filessdf lint path/to/file.sql
to lint a subset of SQL filessdf lint --fix
to fix issues where possiblesdf format
to format sql filessdf-args
block in your sdf workspace file. These
defaults are command line flags that are implicitly added to each invocation of sdf lint
.
Dialect | Availability |
---|---|
Snowflake | 🟢 |
BigQuery | 🟢 |
Redshift | 🟡 |
Trino | 🔴 |
SparkSQL | 🔴 |
sdf-args
configuration. If no overrides for sdf-args
are specified,
any invocation of sdf lint
will use the default lint defaults. These defaults are as below:
sdf lint --fix
sdf lint --fix
to automatically resolve linting issues where possible-- noqa
to your query. This will prevent that line from being
evaluated by the linter, for all rules.
sdf lint
uses SDF’s recommended rules and configurationsdf-args
block in your workspace.sdf.yml
sdf-args:
config block in a workspace file will override the default configuration.Type | Configuration | SDF Err | SQLFluff Err | Auto-Fix | Default |
---|---|---|---|---|---|
Syntax | capitalization_keywords | SDF107 | L010 | ✅ | consistent |
Syntax | capitalization-literal | SDF108, SDF109 | L040 | ✅ | consistent |
Syntax | capitalization-type | SDF110 | L063 | ✅ | consistent |
Syntax | capitalization-function | SDF106 | L030 | ✅ | consistent |
Syntax | convention-blocked-words | SDF124 | L029 | ❌ | [] |
Syntax | references-keywords | SDF125 | L029 | ❌ | [] |
Syntax | references-special-chars | SDF117 | L057 | ❌ | "" |
Syntax | references-quoting | SDF118 | L059 | ✅ | on |
Syntax | references-consistent | SDF112 | L028 | ❌ | off |
Syntax | references-qualification | SDF116 | L027 | ❌ | off |
Syntax | ambiguous-column-references | SDF105 | L054 | ❌ | off |
Syntax | structure-else-null | SDF119 | L035 | ✅ | on |
Syntax | structure-simple-case | SDF120 | L043 | ❌ | off |
Syntax | structure-unused-cte | SDF121 | L045 | ✅ | only |
Syntax | structure-nested-case | SDF122 | L058 | ❌ | off |
Syntax | structure-distinct | SDF123 | L015 | ✅ | on |
Syntax | structure-join-condition-order | SDF114 | ST09 | ❌ | off |
Syntax | structure-column-order | SDF115 | L034 | ✅ | off |
Syntax | convention-terminator | SDF111 | L052 | ✅ | on |
Syntax | convention-comma | SDF104 | N/A | ✅ | on |