dbt docs block 的一些技巧
dbt 的docs 实际上自定义上还是很强大的,可以灵活的docs block 解析,同时docs 定义也可以类似model 那样进行引用,当然也包含了一些内部固定模式可以灵活的进行文档的自定义
一些内置自定义玩法
- 自定义文档路径
类似dbt 其他资源一样docs 也是支持自定义的,否则默认会搜索model-paths, seed-paths, analysis-paths, macro-paths 以及 snapshot-paths
配置(dbt_project.yml)
docs-paths: [directorypath]
- overview
可以用来定义website 的信息
参考
{% docs __overview__ %}
# Monthly Recurring Revenue (MRR) playbook.
This dbt project is a worked example to demonstrate how to model subscription
revenue. **Check out the full write-up [here](https://blog.getdbt.com/modeling-subscription-revenue/),
as well as the repo for this project [here](https://github.com/dbt-labs/mrr-playbook/).**
{% enddocs %}
- 项目级别的自定义
参考格式__[project_name]__
可以方便的自定义项目的描述信息
{% docs __dremio_demo_app__ %}
## this is my pacakge demo
### contains
- mymodel-v2
- mymodel-v3
{% enddocs %}
- 类似模型的引用
定义
{% docs table_events %}
This table contains clickstream events from the marketing website.
The events in this table are recorded by Snowplow and piped into the warehouse on an hourly basis. The following pages of the marketing site are tracked:
- /
- /about
- /team
- /contact-us
{% enddocs %}
- 引用
version: 2
models:
- name: events
description: '{{ doc("table_events") }}'
columns:
- name: event_id
description: This is a unique identifier for the event
tests:
- unique
- not_null
说明
dbt 在分析工程上的实践好多地方还是值得学习的,docs 部分的设计就比较强大,对于数据系统的设计上很值得学习参考下
参考资料
https://docs.getdbt.com/docs/collaborate/documentation
https://docs.getdbt.com/reference/resource-properties/description#include-an-image-from-your-repo-in-your-descriptions
https://docs.getdbt.com/docs/collaborate/documentation
https://docs.getdbt.com/reference/dbt-jinja-functions/doc
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2023-04-20 sbom-tool 微软提供sbom工具
2023-04-20 Squirrel 类似clickonce 的工具
2023-04-20 pypiserver 最小开源pip 私服
2021-04-20 cube.js data-blending一些说明
2021-04-20 cube.js 新版本的一些特性
2021-04-20 cube.js TimeoutError: ResourceRequest timed out 问题参考解决方法
2020-04-20 AxonFrameworksAxonFramework jvm 上强大的演进式事件驱动的微服务框架