' dbt文档生成'不会在目录中填充模型列级注释

发布于 2025-02-02 13:51:28 字数 1175 浏览 2 评论 0原文

我将DBT-SnowFlake 1.1.0与相应的DBT核1.1.0使用。

我在YAML文件中添加了模型的文档,即:

>模型/stage/docs.yml

version: 2

models:
  - name: raw_weblogs
    description: Web logs of customer interaction, broken down by attribute (bronze). The breakdown is performed using regular expressions.
    columns:
      - name: ip
        description: IP address from which the request reached the server (might be direct customer IP or the address of a VPN/proxy).
...

尽管这些细节在dbt中正确显示ui 当我运行dbt docs生成,然后dbt文档服务,但它们尚未在target/catalog.json中列出。

cat target/catalog.json | grep identity

(no results)

根据 dbt文档,我知道列注释应该是<代码> catalog.json 。

稍后编辑:我尝试运行dbt -debug docs生成,看来所有数据直接从目标环境中检索(在我的情况下为雪花)。看着我在Snowflake中的模型的柱子,它们确实没有在雪花上发布任何评论。

在我看来,潜在的错误可能是dbt Run无法正确地将列元数据持续到雪花上。

I use dbt-snowflake 1.1.0 with the corresponding dbt-core 1.1.0.

I added documentation for my models in yaml files, i.e.:

> models/stage/docs.yml

version: 2

models:
  - name: raw_weblogs
    description: Web logs of customer interaction, broken down by attribute (bronze). The breakdown is performed using regular expressions.
    columns:
      - name: ip
        description: IP address from which the request reached the server (might be direct customer IP or the address of a VPN/proxy).
...

Although these details show up correctly in the DBT UI when i run dbt docs generate and then dbt docs serve, yet they are not listed in target/catalog.json:

cat target/catalog.json | grep identity

(no results)

According to the DBT documentation, I understand that column comments should be part of catalog.json.

LATER EDIT: I tried running dbt --debug docs generate and it seems that all data is retrieved directly from the target environment (in my case, Snowflake). Looking at the columns of my model in Snowflake, they indeed do NOT have any comments posted on the in Snowflake.

It thus seems to me that the underlying error might be with the fact that dbt run does not correctly persist the column metadata to Snowflake.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深白境迁sunset 2025-02-09 13:51:28

经过进一步调查,我发现缺乏评论的原因确实是一个事实,即在运行catalog.json运行dbt docs生成的事实是根据收到的数据库,而dbt文档服务通过将来自catalog.json的信息与元数据(在我的情况下,是记录的列注释)结合到本地DBT模型中,从而填充了UI。

使用dbt Run在数据库中坚持此类元数据的解决方案是添加以下DBT配置:

&gt; dbt_project.yml
models:
  <project>:
    ...
    +persist_docs:
      relation: true
      columns: true

After further investigation, I found out the reason for lacking comments was indeed the fact that the comments are written to catalog.json when running dbt docs generate based on what is received from the database, while dbt docs serve populates the UI by combining information from catalog.json with metadata (in my case, documented column comments) from the local dbt models.

The solution to persist such metadata in the database with dbt run was to add the following DBT configuration:

> dbt_project.yml
models:
  <project>:
    ...
    +persist_docs:
      relation: true
      columns: true
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文