I’m trying to add a test to a dbt model, however there’s an error while running dbt test
. I tried to strip down the test to a minimal but still couldn’t find where the problem is. Could someone please help? Thank you.
The project structure is:
dbt_main
-- |marcos
|models
--|my_project
--|mart
--_my_project_models.yaml
--my_model.sql
|target
|tests
--|generic
--| count.sql
|dbt_project.yml
In the _my_project_models.yaml
:
models:
- name: my_model
tests:
- count
columns:
- name: col1
data_type: string
- name: id
data_type: string
and the count.sql looks like this:
{% test count (model) %}
select *
from {{ model }}
where id is not null
{% endtest %}