Dbt compile/run can't figure out the correct schema/dataset

Hi all,

Currently, I have two profiles setup in my dbt_project: prod and dev. When I am running dbt compile/run with the prod environment, the compiled SQL in the target folder contains all the correct references to specific dataset/schemas cofigured in my dbt_project.yml.

However, when I am running the dev target, it just uses the dataset/schema configured within profiles.yml. Why is this, and how can I influence this (or how can the dev target behave the same as prod)? The documentation couldn’t help (as far from what I read about dbt_projects, environments, profles) me further with this problem.

Thanks in advance!

Is it possible that you are not changing the target key to dev before running?
This is how profile.yml looks.

# example profiles.yml file
jaffle_shop:
  target: prod
  outputs:
    dev:
      type: postgres
      host: localhost
      user: alice
      password: <password>
      port: 5432
      dbname: jaffle_shop
      schema: dbt_alice
      threads: 4
    prod:
      type: postgres
      host: localhost
      user: alice
      password: <password>
      port: 5432
      dbname: jaffle_shop
      schema: dbt_alice
      threads: 4

You have to change the target key from prod to dev.
Is that the case?

Yes, I am using a expliciet target key. However, the schema of dev persist when running it. According to the dbt source code on GitHub, this is the expected behaviour. Only with a prod target key dbt ‘respects’ the dbt_project.yml settings for specific schemas.