Hi. I created a new branch to test elementary in m...
# community-support
m
Hi. I created a new branch to test elementary in my dbt project. I then switched branches to main and locally ran the dbt process but the elementary models still ran but this time instead of
<target_schema>_elementary
they all got generated in
<target_schema>
! Is this expected behaviour? Why does this happen? Is this because the dbt_packages folder is untracked? If so, what is it within this package that still runs the models even if no elementary profile has been defined/no config added to dbt_project.yml such as the below
Copy code
elementary:
    +schema: "elementary"
d
Hey @Max, Just to make sure I got it - you have this on your
dbt_project.yml
-
Copy code
elementary:
    +schema: "elementary"
?
m
In the test branch I did add it in my dbt_project.yml and it worked perfectly (<target_schema>_elementary) But then when I switched to main (no longer in the yml file) it still generated the elementary models (which I didn't expect) but this time in my <target schema>.
d
So yes, if you don't have this on your
dbt_projecy.yml
, it will generate elementary's models in your target schema.
m
And I'm guessing since the elementary package is untracked and thus still visible to the main branch the elementary models are still getting activated. What's the best practice here for testing between branches? Perhaps if the elementary config is not defined in the
dbt_project.yml
then the default behavior should be to not generate the elementary models
d
You can maybe disable elementary conditionally on some variable -
Copy code
models:
  elementary:
    enabled: {{ some_var }}
    +schema: "elementary"
m
I'm a big fan of Elementary which is why I suggest the below. I still think it's worth reviewing the default behaviour here to only run the elementary models when explicitly defining it in the
dbt_project.yml
so it only runs when defined rather than having to define it to not run on everything else. Additionally I think the target_schema should be a protected schema and unless explicitly defined, the models should write into
<target_schema>_elementary