[英]How to persist column descriptions in BigQuery tables
我在我的dbt(數據構建工具)中創建了模型,並在其中指定了列描述。 在我的dbt_project.yml文件中,如下所示
models:
sakila_dbt_project:
# Applies to all files under models/example/
+persist_docs:
relation: true
columns: true
events:
materialized: table
+schema: examples
我已經添加了 dbt 所描述的+persist_docs作為修復以使列描述出現但仍然沒有描述出現在 bigquery 表中。
我的models/events/events.yml
看起來像這樣
version: 2
models:
- name: events
description: This table contains clickstream events from the marketing website
columns:
- name: event_id
description: This is a unique identifier for the event
tests:
- unique
- not_null
- name: user-id
quote: true
description: The user who performed the event
tests:
- not_null
我錯過了什么?
ps 我使用的是 dbt 版本 0.21.0
看起來與文檔中所示的所需格式一致:
dbt_project.yml
models:
..[<resource-path>](resource-path):
....+persist_docs:
......relation: true
......columns: true
models/schema.yml
version: 2
models:
..- name: dim_customers
....description: One record per customer
....columns:
......- name: customer_id
........description: Primary key
也許是間距? 我在上面的示例中將空格轉換為句點,因為空格的數量對於 yml 文件來說是不可原諒的。
我已經開始使用 vscode yml 格式化程序,因為我經常在schema.yml
和dbt_project.yml
中遇到這些鍵的間距問題
否則,這不適用於source
或external-table
,對嗎? 這些是不支持persist-docs
的僅有的兩個工件。
此外,如果您要經常使用persist_docs,請查看Jeremy 留下的這個宏示例persist_docs_op ,以進行run-operation
以更新您的持久文檔,以防您更改了所有內容!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.