The problem I’m having
I cannot test several models at once and I need to access the name of the model being tested as I am calling a generic test
The context of why I’m trying to do this
(All the code snippets are from my schema.yml)
Working on a numerous amount of models, I want to group tests and ideally have something like:
version: 2
models:
- name: '*'
tests:
- condition_ratio:
source_table: "{{ get_source_table('*.name') }}"
(Obviously the above code is ridiculous but it is there to explain the end idea).
What I’ve already tried
- Using the ‘group’ tag and applying it to my schema.yml scoped file among my other tests.
- Using the "-name: ‘*’ " model to try to “apply to all” models including these in sub-folders.
Some example code or error messages
The following code
version: 2
models:
- name: '*'
tests:
- my_condition:
source_table: "{{ get_source('model.name') }}"
Gives me
'test.proj.condition_macro.modelname' (path\to\schema.yml) depends on a node named '*' in package ' ' which was not found
Encountered an error:
Parsing Error in model my_model1 (path\to\my_model1.sql)
Invalid group 'published', expected one of []