ARTS第三周 T
dbt Developer Hub (getdbt.com)
安装
pip install dbt-core dbt-clickhouse
注意一些依赖: redhat-rpm-config gcc libffi-devel python3-devel openssl-devel
还有backports.datetime_fromisoformat 安装时报:
backports/datetime_fromisoformat/_datetimemodule.c: 在函数‘_sanitize_isoformat_str’中:
backports/datetime_fromisoformat/_datetimemodule.c:776:5: 错误:只允许在 C99 模式下使用‘for’循环初始化声明
for(size_t idx = 0;
^
类似这个issue:
解决步骤:通过源码编译:python setup.py install
前提是在setup.py里把os.versiron配置了:os.environ
os.environ["CFLAGS"] = " -Werror "
os.environ["CFLAGS"] += " -std=c99"
记得注意虚拟环境的问题。
初始化DBT构建项目
dbt init dbt_project
reating dbt configuration folder at /root/.dbt
Your new dbt project "dbt_ch_project" was created! If this is your first time
using dbt, you'll need to set up your profiles.yml file -- this file will tell dbt how
to connect to your database. You can find this file by running:xdg-open /root/.dbt
For more information on how to configure the profiles.yml file,
please consult the dbt documentation here:https://docs.getdbt.com/docs/configure-your-profile
One more thing:
Need help? Don't hesitate to reach out to us via GitHub issues or on Slack:
https://community.getdbt.com/
Happy modeling!
创建profile.yml, 配置dbt_project.yml
Connection profiles | dbt Developer Hub (getdbt.com)
然后dbt debug检查是否正确。
dbt run执行数据模型。
dbt docs generate 生成文档。
dbt docs serve 在线文档