Skip to content

如何安裝 dbt

Published: at 下午11:16

dbt 是一款 SQL 為主要導向的轉換工作流程,它使團隊可以按照模塊化、可移植性、CI/CD 和文檔等軟體工程最佳實踐快速協作部署分析程式碼。讓數據團隊中的任何人都可以安全的為產品級資料處理做出貢獻。

安裝方法

  1. mac HomeBrew
  2. pip install
  3. docker
  4. source code

我使用 2 pip 來安裝

安裝環境是 ubuntu 18

基礎要安裝好 python3

安裝dbt-core

pip install dbt-core

安裝adpter (我需要的是bq)

pip install dbt-bigquery

安裝完可能會跳出

The script sqlformat is installed in '/home/ubuntu/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

的錯誤訊息

這邊的意思 是提示 說沒有設定環境變數

如果你鍵入dbt 也會是 dbt not found

所以你要到該使用者的家目錄(~)

新增一個檔案 ./bash_profile

vi ~/.bash_profile

因為東西是安裝在 /home/ubuntu/.local/bin 所以要

輸入 export PATH=“/home/ubuntu/.local/bin:$PATH”

:wq

修改完後要讓他生效

source ~/.bash_profile

dbt 就會成功被抓到了