I am trying to get sqlfluff to perform various alignments within our company’s SQL code. The one I’m struggling with is the alignment within the join clause
For example, code as written:
select *
from table_1
join table_2 alias on table_1.key = alias.key
join table_3 alias3 on table_1.key = alias3.key
SQL fluff output
select *
from table_1
join table_2 alias on table_1.key = alias.key
join table_3 alias3 on table_1.key = alias3.key
Desired output
select *
from table_1
join table_2 alias on table_1.key = alias.key
join table_3 alias3 on table_1.key = alias3.key
It seems like this should be possible, but I cannot figure out what the name of the ON portion of the join is called in the sqlfluff config (if it exists).
for example
[sqlfluff:layout:type:alias_expression]
spacing_before = align
align_within = statement
align_scope = bracketed
works to align the alias but the ON portion of the join begins a single space after the alias. What I would like to have happen is the table alias and ON portion to be aligned independently. I can’t figure out what the right component name within the [sqlfluff:layout:type: portion of the config is. If anyone knows where to look for the full list of options or has a suggestion on this one I’d much appreciate it. Thanks.
ajssbp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.