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;
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.
| Option | Default | SQLFluff calls it |
|---|---|---|
width | 80 | max_line_length |
indent.width | 4 | indentation.tab_space_size |
indent.style | indentation.indent_unit | |
line-ending | "auto" | |
trailing-comma.add | "preserve" | |
trailing-comma.forces-break | false | |
quotes | "preserve" | |
target | dialect |
Its own options
Set in a table named for it, such as [format.sqlfluff], or in a language's table, as sqlfluff = { ... }.
| Option | Default | Values |
|---|---|---|
dialect | | any value |
templater | "jinja" | a string |
exclude_rules | | any value |
ignore_templated_areas | true | true or false |
encoding | "autodetect" | a string |
large_file_skip_char_limit | 0 | a number |
large_file_skip_byte_limit | 20000 | a number |
large_file_skip_fail | false | true or false |
max_line_length | 80 | a number |
indentation.indent_unit | "space" | a string |
indentation.tab_space_size | 4 | a number |
indentation.indented_joins | false | true or false |
indentation.indented_ctes | false | true or false |
indentation.indented_using_on | true | true or false |
indentation.indented_on_contents | true | true or false |
indentation.indented_then | true | true or false |
indentation.indented_then_contents | true | true or false |
indentation.implicit_indents | "forbid" | a string |
indentation.template_blocks_indent | true | true 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_lines | false | true 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_queries | true | true or false |
templater.jinja.apply_dbt_builtins | true | true or false |
rules.capitalisation.keywords.capitalisation_policy | "consistent" | a string |
rules.capitalisation.keywords.ignore_words | | any value |
rules.capitalisation.keywords.ignore_words_regex | | any value |
rules.capitalisation.identifiers.extended_capitalisation_policy | "consistent" | a string |
rules.capitalisation.identifiers.ignore_words | | any value |
rules.capitalisation.identifiers.ignore_words_regex | | any value |
rules.capitalisation.functions.extended_capitalisation_policy | "consistent" | a string |
rules.capitalisation.functions.ignore_words | | any value |
rules.capitalisation.functions.ignore_words_regex | | any value |
rules.capitalisation.literals.capitalisation_policy | "consistent" | a string |
rules.capitalisation.literals.ignore_words | | any value |
rules.capitalisation.literals.ignore_words_regex | | any value |
rules.capitalisation.types.extended_capitalisation_policy | "consistent" | a string |
rules.capitalisation.types.ignore_words | | any value |
rules.capitalisation.types.ignore_words_regex | | any 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_lines | false | true or false |
rules.layout.long_lines.ignore_comment_clauses | false | true or false |
rules.layout.newlines.maximum_empty_lines_between_statements | 2 | a number |
rules.layout.newlines.maximum_empty_lines_inside_statements | 1 | a number |
rules.layout.newlines.maximum_empty_lines_between_batches | 1 | a number |
rules.layout.select_targets.wildcard_policy | "single" | a string |
rules.layout.select_targets.single_target_policy | "same_line" | a string |