# FAQ: Configuring models' materializations based on environments

**URL:** <https://discourse.getdbt.com/t/faq-configuring-models-materializations-based-on-environments/463>\
**Category:** Show and Tell\
**Tags:** materialization, environments\
**Created:** [July 17, 2019, 6:14pm UTC](https://discourse.getdbt.com/t/faq-configuring-models-materializations-based-on-environments/463 "2019-07-17T18:14:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![claire](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/claire/32/522_2.png) [@claire](https://discourse.getdbt.com/u/claire)\
**Post date:** [July 17, 2019, 6:14pm UTC](https://discourse.getdbt.com/t/faq-configuring-models-materializations-based-on-environments/463/1 "2019-07-17T18:14:25Z")

</div>

We’ve had a couple of questions recently about configuring models based on your environment (or target) over on Slack, spefically around:

- Using views in `dev` and tables in `prod`
- [Snowflake only] Using transient tables in `dev` and non-transient in `prod`.

* * *

 ![55%20PM](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/8c3001c36b017c2051aab4d2319c14ad1f4bbf18.png)

* * *

 ![43%20PM](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/50479db6e0c1fe5e1fe6a7e95224875bbfdb5a01.png)

* * *

The best approach is to configure this straight from your `dbt_project.yml` file:

```auto
models:
  materialized: "{{ 'table' if target.name == 'prod' else 'view' }}"

```

If you need the output to be a boolean:

```auto
models:
  materialized: "{{ 'table' if target.name == 'prod' else 'view' }}"
  my_project:
    for_export:
      enabled: "{{ (target.name == 'prod') | as_bool }}"

```

Another approach is to set the materialization rule on a per-model level:

```auto
{{
    config(
        materialized=('table' if target.name == 'prod' else 'view')
    )
}}

```

However, if you are using Slim CI, this approach will lead to models running unnecessarily because the file’s contents change between `prod` and `dev`.

You could also conceivably create a [custom materialization](https://docs.getdbt.com/docs/creating-new-materializations) that packages up this logic, but I’d recommend this as a last resort!
