SQLFluff

SQLFluff, the SQL linter and formatter.

Formats
SQL
In ur.toml
[format.sql] style = "sqlfluff"
Its options
https://docs.sqlfluff.com/en/stable/configuration/index.html

Formatted

extents.sql, as written
-- The space each data file uses.
select e.file_id,f.file_name,sum(e.blocks) allocated,f.blocks "FILE SIZE" from dba_extents e join dba_data_files f on e.file_id=f.file_id where f.status='AVAILABLE' group by e.file_id,f.file_name,f.blocks order by e.file_id;
ur format --style sqlfluff extents.sql
-- The space each data file uses.
select e.file_id, f.file_name, sum(e.blocks) allocated, f.blocks "FILE SIZE" from dba_extents e join dba_data_files f on e.file_id = f.file_id where f.status = 'AVAILABLE' group by e.file_id, f.file_name, f.blocks order by e.file_id;

Try it in the playground →

Defaults

The shared options, as SQLFluff sets them when nothing configures it. Its own names for them are read from its configuration files, but ur.toml sets them by the shared name only.

OptionDefaultSQLFluff calls it
width80max_line_length
indent.width4indentation.tab_space_size
indent.styleindentation.indent_unit
line-ending"auto"
trailing-comma.add"preserve"
trailing-comma.forces-breakfalse
quotes"preserve"
targetdialect

Its own options

Set in a table named for it, such as [format.sqlfluff], or in a language's table, as sqlfluff = { ... }.

OptionDefaultValues
dialectany value
templater"jinja"a string
exclude_rulesany value
ignore_templated_areastruetrue or false
encoding"autodetect"a string
large_file_skip_char_limit0a number
large_file_skip_byte_limit20000a number
large_file_skip_failfalsetrue or false
max_line_length80a number
indentation.indent_unit"space"a string
indentation.tab_space_size4a number
indentation.indented_joinsfalsetrue or false
indentation.indented_ctesfalsetrue or false
indentation.indented_using_ontruetrue or false
indentation.indented_on_contentstruetrue or false
indentation.indented_thentruetrue or false
indentation.indented_then_contentstruetrue or false
indentation.implicit_indents"forbid"a string
indentation.template_blocks_indenttruetrue or false
indentation.skip_indentation_in"script_content"a string
indentation.skip_implicit_indents_in"case_expression"a string
indentation.trailing_comments"before"a string
indentation.ignore_comment_linesfalsetrue or false
layout.type.comma.spacing_before"touch"a string
layout.type.comma.line_position"trailing"a string
layout.type.binary_operator.spacing_within"touch"a string
layout.type.binary_operator.line_position"leading"a string
layout.type.column_path_operator.spacing_within"touch"a string
layout.type.column_path_operator.line_position"leading"a string
layout.type.pipe_operator.line_position"leading:attached:strict"a string
layout.type.statement_terminator.spacing_before"touch"a string
layout.type.statement_terminator.line_position"trailing"a string
layout.type.end_of_file.spacing_before"touch"a string
layout.type.set_operator.line_position"alone:strict"a string
layout.type.start_bracket.spacing_after"touch"a string
layout.type.end_bracket.spacing_before"touch"a string
layout.type.start_square_bracket.spacing_after"touch"a string
layout.type.end_square_bracket.spacing_before"touch"a string
layout.type.start_angle_bracket.spacing_after"touch"a string
layout.type.end_angle_bracket.spacing_before"touch"a string
layout.type.casting_operator.spacing_before"touch"a string
layout.type.casting_operator.spacing_after"touch:inline"a string
layout.type.try_casting_operator.spacing_before"touch"a string
layout.type.try_casting_operator.spacing_after"touch:inline"a string
layout.type.slice.spacing_before"touch"a string
layout.type.slice.spacing_after"touch"a string
layout.type.dot.spacing_before"touch"a string
layout.type.dot.spacing_after"touch"a string
layout.type.comparison_operator.spacing_within"touch"a string
layout.type.comparison_operator.line_position"leading"a string
layout.type.assignment_operator.spacing_within"touch"a string
layout.type.assignment_operator.line_position"leading"a string
layout.type.at_sign.spacing_before"touch"a string
layout.type.at_sign.spacing_after"touch"a string
layout.type.attribute_indicator.spacing_before"touch"a string
layout.type.attribute_indicator.spacing_after"touch"a string
layout.type.object_reference.spacing_within"touch:inline"a string
layout.type.numeric_literal.spacing_within"touch:inline"a string
layout.type.sign_indicator.spacing_after"touch:inline"a string
layout.type.tilde.spacing_after"touch:inline"a string
layout.type.function_name.spacing_within"touch:inline"a string
layout.type.function_contents.spacing_before"touch:inline"a string
layout.type.function_parameter_list.spacing_before"touch:inline"a string
layout.type.array_type.spacing_within"touch:inline"a string
layout.type.array_type_suffix.spacing_before"touch"a string
layout.type.typed_array_literal.spacing_within"touch"a string
layout.type.sized_array_type.spacing_within"touch"a string
layout.type.struct_type.spacing_within"touch:inline"a string
layout.type.bracketed_arguments.spacing_before"touch:inline"a string
layout.type.match_condition.spacing_within"touch:inline"a string
layout.type.typed_struct_literal.spacing_within"touch"a string
layout.type.semi_structured_expression.spacing_within"touch:inline"a string
layout.type.semi_structured_expression.spacing_before"touch:inline"a string
layout.type.array_accessor.spacing_before"touch:inline"a string
layout.type.colon.spacing_before"touch"a string
layout.type.colon_delimiter.spacing_before"touch"a string
layout.type.colon_delimiter.spacing_after"touch"a string
layout.type.substitution_variable.spacing_within"touch"a string
layout.type.substitution_variable.spacing_before"any"a string
layout.type.substitution_variable.spacing_after"any"a string
layout.type.path_segment.spacing_within"touch"a string
layout.type.sql_conf_option.spacing_within"touch"a string
layout.type.sqlcmd_operator.spacing_before"touch"a string
layout.type.slash.spacing_before"any"a string
layout.type.slash.spacing_after"any"a string
layout.type.comment.spacing_before"any"a string
layout.type.comment.spacing_after"any"a string
layout.type.pattern_expression.spacing_within"any"a string
layout.type.bind_variable.spacing_within"touch"a string
layout.type.psql_variable.spacing_within"touch"a string
layout.type.placeholder.spacing_before"any"a string
layout.type.placeholder.spacing_after"any"a string
layout.type.common_table_expression.spacing_within"single:inline"a string
layout.type.select_clause.line_position"alone"a string
layout.type.where_clause.line_position"alone"a string
layout.type.where_clause.keyword_line_position"leading"a string
layout.type.where_clause.keyword_line_position_exclusions"pipe_operator_clause"a string
layout.type.from_clause.line_position"alone"a string
layout.type.join_clause.line_position"alone"a string
layout.type.groupby_clause.line_position"alone"a string
layout.type.groupby_clause.keyword_line_position"leading"a string
layout.type.orderby_clause.line_position"leading"a string
layout.type.orderby_clause.keyword_line_position"leading"a string
layout.type.orderby_clause.keyword_line_position_exclusions"\nwindow_specification,\naggregate_order_by,\nwithingroup_clause,\npipe_operator_clause"a string
layout.type.having_clause.line_position"alone"a string
layout.type.having_clause.keyword_line_position"leading"a string
layout.type.limit_clause.line_position"alone"a string
layout.type.template_loop.spacing_before"any"a string
layout.type.template_loop.spacing_after"any"a string
templater.unwrap_wrapped_queriestruetrue or false
templater.jinja.apply_dbt_builtinstruetrue or false
rules.capitalisation.keywords.capitalisation_policy"consistent"a string
rules.capitalisation.keywords.ignore_wordsany value
rules.capitalisation.keywords.ignore_words_regexany value
rules.capitalisation.identifiers.extended_capitalisation_policy"consistent"a string
rules.capitalisation.identifiers.ignore_wordsany value
rules.capitalisation.identifiers.ignore_words_regexany value
rules.capitalisation.functions.extended_capitalisation_policy"consistent"a string
rules.capitalisation.functions.ignore_wordsany value
rules.capitalisation.functions.ignore_words_regexany value
rules.capitalisation.literals.capitalisation_policy"consistent"a string
rules.capitalisation.literals.ignore_wordsany value
rules.capitalisation.literals.ignore_words_regexany value
rules.capitalisation.types.extended_capitalisation_policy"consistent"a string
rules.capitalisation.types.ignore_wordsany value
rules.capitalisation.types.ignore_words_regexany value
rules.convention.not_equal.preferred_not_equal_style"consistent"a string
rules.convention.select_trailing_comma.select_clause_trailing_comma"forbid"a string
rules.layout.long_lines.ignore_comment_linesfalsetrue or false
rules.layout.long_lines.ignore_comment_clausesfalsetrue or false
rules.layout.newlines.maximum_empty_lines_between_statements2a number
rules.layout.newlines.maximum_empty_lines_inside_statements1a number
rules.layout.newlines.maximum_empty_lines_between_batches1a number
rules.layout.select_targets.wildcard_policy"single"a string
rules.layout.select_targets.single_target_policy"same_line"a string