# setting env\_var in config block

**URL:** <https://discourse.getdbt.com/t/setting-env-var-in-config-block/12464>\
**Category:** Help\
**Tags:** dbt-core\
**Created:** [March 13, 2024, 6:18pm UTC](https://discourse.getdbt.com/t/setting-env-var-in-config-block/12464 "2024-03-13T18:18:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ortizfabio](https://avatars.discourse-cdn.com/v4/letter/o/e47774/32.png) [@ortizfabio](https://discourse.getdbt.com/u/ortizfabio)\
**Post date:** [March 13, 2024, 6:18pm UTC](https://discourse.getdbt.com/t/setting-env-var-in-config-block/12464/1 "2024-03-13T18:18:03Z")

</div>

I have this config block in which there is a database field set using env\_var macros. I have tried couple syntax but I still get an error. Here is the latest test. Notice that I have an underscore before the env vars to separate the tokens. I have tried using spaces but I get the same.

```auto
{{-
    config(
        materialized='incremental_stream',
        database= "env_var('DB_PREFIX')_env_var('DB_ENV')_ANALYTICS_LZ",
        unique_key=['dv_impression_id', '_data_version']
    )
-}}

```
