# How to overwrite schema set in \`profile.yml\`?

**URL:** https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004
**Category:** Archive
**Created:** [September 8, 2021, 5:06pm UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004 "2021-09-08T17:06:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![raaj](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/raaj/32/856_2.png) [@raaj](https://discourse.getdbt.com/u/raaj)
#### Post date: [September 8, 2021, 5:06pm UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004/1 "2021-09-08T17:06:16Z")

</div>

I have given a different schema for a model in `dbt_project.yml` but it is still creating my views in the schema mentioned in `profile.yml`. I do not think it is the expected behavior or is it?  
dbt version 0.20.2

---

<div class="post-metadata">

### Author: ![s.chaser](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@s.chaser](https://discourse.getdbt.com/u/s.chaser)
#### Post date: [September 8, 2021, 11:29pm UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004/2 "2021-09-08T23:29:44Z")

</div>

Any chance that there is yml in the subfolders specified the same schema?

---

<div class="post-metadata">

### Author: ![raaj](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/raaj/32/856_2.png) [@raaj](https://discourse.getdbt.com/u/raaj)
#### Post date: [September 9, 2021, 7:13am UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004/3 "2021-09-09T07:13:32Z")

</div>

No there is not. I checked it.  
This is how my `dbt_project.yml` looks like :

```auto
# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'abc'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'raaj'

# These configurations specify where dbt should look for different types of files.
# The `source-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
    - "target"
    - "dbt_modules"

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/ directory
# as tables. These settings can be overridden in the individual model files
# using the `{{ config(...) }}` macro.
models:
  abc:
    myschema:
      +materialized: view
      +schema: myschema
      +bind: false

```

This is how my `~./dbt/profiles.yaml` looks like

```auto
raaj:
  target: dev  
  outputs:
    dev:
      type: redshift
      threads: 4
      host: xxx
      port: 5439
      user: xxx
      password: xxx
      dbname: xxx
      schema: dbt_raaj
      keepalives_idle: 0
    prod:
      type: redshift
      threads: 4
      host: xxx
      port: 5439
      user: xxx
      password: xxx
      dbname: xxx
      schema: myschema
      keepalives_idle: 0

```

---

<div class="post-metadata">

### Author: ![s.chaser](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@s.chaser](https://discourse.getdbt.com/u/s.chaser)
#### Post date: [September 9, 2021, 11:57pm UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004/4 "2021-09-09T23:57:21Z")

</div>

Hi Raaj, just 2 cents from me:

have you checked if there is any other `.yml` file in the subfolders of which will overrides the schema in the upper level?

Also refer to `... your dbt runs should instead target an existing schema that your user has permission to create relations within.`, it may pays to check the existence of the schema `myschema` and the owner role of that schema…

---

<div class="post-metadata">

### Author: ![k.in](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@k.in](https://discourse.getdbt.com/u/k.in)
#### Post date: [December 1, 2021, 5:54pm UTC](https://discourse.getdbt.com/t/how-to-overwrite-schema-set-in-profile-yml/3004/5 "2021-12-01T17:54:32Z")

</div>

[Deploy to custom schemas & override dbt defaults - YouTube](https://www.youtube.com/watch?v=AvrVQr5FHwk) I found this very helpful.
