Test name string error when using vars to pass test name
The context of why I’m trying to do this
I have created a generic test inside of a package. I want this test update to this package is optional and configurable with the use of global vars inside the dbt_project.yml
.
What I’ve already tried
- this test should be called in a model .yml config file via this reference:
package_name.test_name
(this works when i hard code this test name) - i then put a var in the
dbt_project.yml
:
vars:
'custom_dbt_test': package_name.test_name
then i reference this var to apply this test in a model .yml
config file
tests:
- "{{ var('custom_dbt_test') }}"
Error message that I get
Compilation Error
Invalid generic test configuration given in models/...:
Test name string did not match expected pattern: {{ var('custom_dbt_test') }}
@: UnparsedModelUpdate(original_file_path='mode...ne)