Will
11/30/2023, 12:31 PMproject_a, but we sometimes run DBT from project_b.
I've added this to dbt_project.yml, which I thought should cause Elementary to always look in project_a.elementary when writing data from a `dbt run`:
models:
elementary:
+schema: "elementary"
+project: "{{ env_var('PROJECT_A') }}"
However, this only works when the target in profiles.yml is also set to PROJECT_A. This is a problem for our implementation of DBT because we run queries from different GCP projects. Our profiles.yml looks like this:
my_project:
target: prd
outputs:
prd:
type: bigquery
method: oauth
project: "{{ env_var('GCP_RUNTIME_PROJECT') }}"
dataset: dbt
If GCP_RUNTIME_PROJECT is set to PROJECT_A, elementary runs fine. When it's set to PROJECT_B I get the error:
Couldn't find Elementary's models in `PROJECT_B.dbt`. Please run `dbt run -s elementary --target dev`.
The service account used in PROJECT_B has permissions to write to PROJECT_A.elementary, so I was expecting it to work. But it seems to ignore the configuration set in dbt_project to always write to PROJECT_A.elementary. The dataset is being set to our default as well (dbt), rather than the configured dataset (elementary).
Is this by design or a bug? I was hoping it would be possible to use Elementary when the target is changed in profiles.yml? If it's by design, any suggestions on how to work around it? I was thinking potentially having an elementary schema in each project, but that means having multiple reports/monitors setup, which will be trickier to manage.
Thanks in advanceNoa Kurman
12/04/2023, 11:41 AMWill
12/04/2023, 3:55 PMNoa Kurman
12/05/2023, 10:20 AMWill
12/08/2023, 2:46 PMCouldn't find Elementary's models in `PROJECT_B.dbt`. Please run `dbt run -s elementary --target stg`.
where DBT is our default output schema. I've tracked the error down to this line returning None. It seems to fallback to a default value of target_database.default_schema - the problem isn't in elementary though, figured out our permissions setup is preventing Elementary from seeing the PROJECT_A.elementary datasetOfek Weiss
01/07/2024, 4:11 PMWill
01/08/2024, 11:58 AMOfek Weiss
01/08/2024, 2:11 PM