2 Comments
User's avatar
iamtodor's avatar

Thanks for this post. I'm wondering if it would be possible to create a separate data file (csv / jsonl[1]) to provide the data? Because while the sandbox example is great, on real-world prod usually we have like 20-30+ fields (columns) models and describe the data in yaml file using the following

```

- input: ref('stg__users')

format: csv

rows: |

```

causes eye pain. So I'm wondering if it would be possible to create something like `dbt-project/unit_testing/stg__users/input.csv` where we could comfortably describe the data and then link this file to the test configuration.

Thanks in advance!

[1]. https://jsonlines.org/

Expand full comment
Oleg Agapov's avatar

Yes, it is possible!

It is called a fixture, and you can define them in `tests/fixtures` folder as CSV files and use as input for unit tests. See example here:

https://docs.getdbt.com/reference/resource-properties/data-formats#csv

Expand full comment