如何在DBT中设置profiles.yml和dbt_project.yml文件的位置?

问题描述 投票:0回答:3

运行

dbt debug --config-dir
显示不正确的位置。

例)

12:35:52  Running with dbt=1.0.3
12:35:52  To view your profiles.yml file, run:

open /The/wrong/directory

如何告诉 DBT 我已经移动了

profiles.yml
dbt_profile.yml
文件?

sql database etl dbt
3个回答
2
投票

dbt run --help
表明有两个标志用于此特定目的。

  --project-dir PROJECT_DIR
                        Which directory to look in for the dbt_project.yml file. Default is the current working directory and its parents.
  --profiles-dir SUB_PROFILES_DIR
                        Which directory to look in for the profiles.yml file. Default = /Users/username/.dbt

您要运行的命令是:

dbt run --project-dir /path/to/new/dbt_project.yml_file --profiles-dir /path/to/new/profiles.yml_file

2
投票

在提示符下输入:

export DBT_PROFILES_DIR=/path/to/folder

此命令会将您的

profiles.yml
的位置重新分配到
/path/to/folder
中提到的文件夹。

完成后,运行:

dbt debug --config-dir


0
投票

你还可以使用两个环境变量:

  • DBT_PROJECT_DIR
  • DBT_PROFILES_DIR

设置文件夹的位置。

这是

profiles.yml
的完整搜索顺序:

  1. --profiles-dir option
  2. DBT_PROFILES_DIR
    环境变量
  3. 当前工作目录(新)
  4. ~/.dbt/
    目录

dbt_project.yml
的搜索顺序:

  1. --project-dir option
  2. DBT_PROJECT_DIR
    环境变量(新)
  3. 当前工作目录
© www.soinside.com 2019 - 2024. All rights reserved.