PabloRMira / sql_formatter

A Python based SQL formatter
https://pablormira.github.io/sql_formatter/
Apache License 2.0
43 stars 10 forks source link

[FEA] Reformat case when if line too long #109

Closed PabloRMira closed 3 years ago

PabloRMira commented 3 years ago

Related to #52

E.g.

select asdf,
       case when asdf >= 1 and asdf <= 10 and substr(qwer, 1, 2) = 'abc' and substr(qwer, 3, 2) = 'qwerty' then 1
            else 0 end as case_field,
       asdf2
from table1

should be formatted as

select asdf,
       case when asdf >= 1 and 
                 asdf <= 10 and 
                 substr(qwer, 1, 2) = 'abc' and 
                 substr(qwer, 3, 2) = 'qwerty' then 1
            else 0 end as case_field,
       asdf2
from table1