# how can dbt read files and use it when refresh model

**URL:** <https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908>\
**Category:** Help\
**Created:** [June 28, 2023, 10:18pm UTC](https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908 "2023-06-28T22:18:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xuzheng](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/xuzheng/32/2628_2.png) [@xuzheng](https://discourse.getdbt.com/u/xuzheng)\
**Post date:** [June 28, 2023, 10:18pm UTC](https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908/1 "2023-06-28T22:18:36Z")

</div>

i have some configuration files. inside the configuration file, it has different attribute value like account\_id, name. how can i read the file during model refresh? found below solution, but looks like dbt doesn’t have read\_file function.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/2X/8/80896a9138fe59812c20c7dad191495e06ac1136.png)

configuration files is like below:  
xx.config:

BINARY\_TAB\_FILE=TRUE  
USE\_END=TRUE  
ACCOUNT=10000

Anyone done this before? thanks so much in advance.  
ZX

---

<div class="post-metadata">

**Author:** ![stephen](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@stephen](https://discourse.getdbt.com/u/stephen)\
**Post date:** [August 31, 2023, 1:56pm UTC](https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908/2 "2023-08-31T13:56:29Z")

</div>

Are all your configurations just key value pairs and do you have just 3 configs ?  
If so then you could use either [environment variables](https://docs.getdbt.com/reference/dbt-jinja-functions/env_var) or [dbt variables](https://docs.getdbt.com/reference/dbt-jinja-functions/var).

---

<div class="post-metadata">

**Author:** ![mroy](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/mroy/32/3094_2.png) [@mroy](https://discourse.getdbt.com/u/mroy)\
**Post date:** [September 7, 2024, 6:54am UTC](https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908/3 "2024-09-07T06:54:14Z")

</div>

How we are handling this currently is to store large configs in a macro.

For example:

```auto
{%- macro get_configs() -%}
  {{- return({
    "key": "value",
    "key2": "value2",
    "obj": {
      ...
    },
    ...
  }) -}}
{%- endmacro -%}

```

But it would definitely be nice to be able to load these configs from a YAML file instead!

---

<div class="post-metadata">

**Author:** ![mroy](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/mroy/32/3094_2.png) [@mroy](https://discourse.getdbt.com/u/mroy)\
**Post date:** [September 25, 2024, 5:17am UTC](https://discourse.getdbt.com/t/how-can-dbt-read-files-and-use-it-when-refresh-model/8908/4 "2024-09-25T05:17:18Z")

</div>

Actually, we have now moved to storing these configs in a project variable inside of `dbt_project.yml`!

Like this:

```yaml
vars:
  configs:
    key: value
    key2: value2
    key3:
      a: 1
      b: 2
      ...

```
