如何在运行DBT项目时更改max_line_length?

huangapple go评论63阅读模式
英文:

How to change max_line_length when running a DBT project?

问题

我运行一个DBT项目时遇到了问题。我的一些SQL命令超过了限制(80个字符)。因此,我收到了以下错误信息:

我尝试过在dbt_project.yml和.sqlfluff中更改限制,但都没有生效。

如何解决这个问题并更改长度限制?

英文:

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:
如何在运行DBT项目时更改max_line_length?

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

如何在运行DBT项目时更改max_line_length?

如何在运行DBT项目时更改max_line_length?

How to fix this problem and change the length limit?

答案1

得分: 1

这是一个与代码检查相关的问题,所以很可能与你的 dbt_project.yml 无关。

为了正确设置 .sqlfluff 文件中的 max_line_length 值,你需要将它嵌套在 [sqlfluff] 标签下。也就是说,你的 .sqlfluff 文件应该如下所示:

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

查看 SQLFluff 文档中的示例这里

英文:

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.

huangapple
  • 本文由 发表于 2023年7月14日 08:19:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76683990.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定