# target problems in profiles.yml

**URL:** <https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770>\
**Category:** Help\
**Tags:** dbt-core\
**Created:** [June 11, 2024, 10:50am UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770 "2024-06-11T10:50:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jean.guinvarch](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/jean.guinvarch/32/4128_2.png) [@jean.guinvarch](https://discourse.getdbt.com/u/jean.guinvarch)\
**Post date:** [June 11, 2024, 10:50am UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770/1 "2024-06-11T10:50:31Z")

</div>

## The problem I’m having

_I am fully new to dbt_  
When I try to run “dbt debug” I have this error : Runtime Error  
The profile ‘dev’ does not have a target named ‘dev’. The valid target names for this profile are:

- source
- bloc\_dimensions
- set\_dimensions
- calculations

See the code of profiles.yml and dbt\_project.yml  
I explain the context in the next section.

## The context of why I’m trying to do this

I have a local postgres server with 3 databases. A source database containing the raw data, another database to store materialized dimension models and another databse that stores others materialized dimensions models.  
I want to use the source database to calculate the materialized dimension models and store those tables in a specific database (bloc\_dimensions/set\_dimensions) of the postgres server. I don’t know if it is a good practice or not.

## What I’ve already tried

I tried to setup differents outputs (see the code) on the same profile but I have an error and I don’t really understand why.

## Some example code or error messages

```auto
profiles.yml
dev:
  target: dev
  outputs:
    source:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: ebay_sales_db
      schema: public
      threads: 4
    bloc_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: bloc_db
      threads: 4
    set_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: set_db
    calculations:
      type: duckdb
      path: /path/to/your/duckdb/database

prod:
  target: prod
  outputs:
    prod:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: ebay_sales_db
      schema: public
      threads: 4
    bloc_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: bloc_db
      threads: 4
    set_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: set_db
    calculations:
      type: duckdb
      path: /path/to/your/duckdb/database

dbt_project.yml
name: "dbt_poke_price_tracker"
version: "1.0.0"

profile: "dev"

model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets: # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"

models:
  dbt_poke_price_tracker:
    staging:
      materialized: view
      +persisted: true 
    
    bloc_dimensions:
      materialized: table
      +persisted: true
      +database: bloc_dimensions

    set_dimensions:
      materialized: table   
      +persisted: true
      +database: set_dimensions 

```

---

<div class="post-metadata">

**Author:** ![DataNath](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/datanath/32/4070_2.png) [@DataNath](https://discourse.getdbt.com/u/DataNath)\
**Post date:** [June 11, 2024, 12:42pm UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770/2 "2024-06-11T12:42:18Z")

</div>

Hey @jean.guinvarch, at the moment you’re trying to set 3 locations as a single target. You’re also looking for a target named ‘dev’ despite your actual targets in this case being ‘source’, ‘bloc\_dimension’ and ‘set\_dimensions’. If you change your `profiles.yml` file to be something like below then you’ll have all 3 targets stored within your ‘dev’ profile. When you need to reference each of these different targets throughout your workflow you can do so using target variables. Some useful info here: [About target variables | dbt Developer Hub](https://docs.getdbt.com/reference/dbt-jinja-functions/target) & [Custom target names | dbt Developer Hub](https://docs.getdbt.com/docs/build/custom-target-names).

```auto
dev:
  target: source
  outputs:
    source:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: ebay_sales_db
      schema: public
      threads: 4
  target: bloc_dimension
  outputs:
    bloc_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: bloc_db
      schema: public
      threads: 4
  target: set_dimensions
  outputs:
    set_dimensions:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: set_db
      schema: public
    calculations:
      type: duckdb
      path: /path/to/your/duckdb/database

```

Note: I’ve only changed your ‘dev’ profile here. You’ll need to make the same changes for prod otherwise you’ll run into the same error in that env.

---

<div class="post-metadata">

**Author:** ![brunoszdl](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/brunoszdl/32/4113_2.png) [@brunoszdl](https://discourse.getdbt.com/u/brunoszdl)\
**Post date:** [June 11, 2024, 12:59pm UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770/3 "2024-06-11T12:59:20Z")

</div>

Hey @jean.guinvarch

If you want some models to be built in a different database, you don’t need to define it in profiles.yml

You can use the database config [database | dbt Developer Hub](https://docs.getdbt.com/reference/resource-configs/database)

takes this example

dbt\_project.yml

```auto
models:
  your_project:
    sales_metrics:
      +database: reporting

```

Here all models inside `models/sales_metrics/` will be built on the `reporting` database

And you can keep your profiles like

```auto
my_profile:
  target: dev
  outputs:
    dev:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: ebay_sales_db
      schema: dev
      threads: 4
    prod:
      type: postgres
      host: localhost
      user: postgres
      pass: Tictact0c!
      port: 5432
      dbname: ebay_sales_db
      schema: prod
      threads: 4
    calculations:
      type: duckdb
      path: /path/to/your/duckdb/database

```

---

<div class="post-metadata">

**Author:** ![jean.guinvarch](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/jean.guinvarch/32/4128_2.png) [@jean.guinvarch](https://discourse.getdbt.com/u/jean.guinvarch)\
**Post date:** [June 11, 2024, 1:19pm UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770/4 "2024-06-11T13:19:14Z")

</div>

Thank you ! That what I tried and I think it is working fine. my dbt\_project.yml looks like this :

```auto
profile: "dev"
          
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets: # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"

models:
  dbt_poke_price_tracker:
    
    
    staging:
      materialized: view
      +persisted: true 
    
    bloc_dimensions:
      materialized: table
      +persisted: true
      +database: bloc_dimensions

    set_dimensions:
      materialized: table   
      +persisted: true
      +database: set_dimensions 

```

I set up profiles.yml like this :

```auto
dev:
  target: dev
  outputs:
    dev:
      type: postgres
      host: localhost
      user: postgres
      pass: __________
      port: 5432
      dbname: ebay_sales_db
      schema: public
      threads: 4
    duckdb:
      type: duckdb
      path: "dbt_poke_price_tracker/database/ebay_sales.duckdb"

```

---

<div class="post-metadata">

**Author:** ![Miroslaw](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@Miroslaw](https://discourse.getdbt.com/u/Miroslaw)\
**Post date:** [June 24, 2024, 10:05am UTC](https://discourse.getdbt.com/t/target-problems-in-profiles-yml/13770/5 "2024-06-24T10:05:50Z")

</div>

dbt is transformation tool not an ETL tool. In profiles.yml you are confusing profile with target name.  
First name dev is profile you are using in dbt\_project.yml . Second dev in outputs is the name of your target. dbt will always operate on target database and the only way you can access other postgres db is through some kind of dblink like in oracle.
