sqlprojectdbtsqlfluff

How to change max_line_length when running a DBT project?


I have a problem when run a DBT project. Some of my SQL commands are longer then the limit (80). So I have got the following error info: enter image description here

I have tried to change the limit in dbt_project.yml and .sqlfluff. But none of the worked.

enter image description here

enter image description here

How to fix this problem and change the length limit?


Solution

  • That's a linter-related issue, so most probably nothing to do with your dbt_project.yml.

    In order to correctly set a max_line_length value in your .sqlfluff file, you need to nest it under the [sqlfluff] tag. Meaning that your .sqlfluff file should look like this:

    [sqlfluff]
    dialect = snowflake
    exclude_rules = L031
    max_line_length = 120
    

    See this example for SQLFluff's docs here.