How to use anchors in schema.yml

Hi all,
I tried to set up anchoring while declaring tests as recommended here: https://docs.getdbt.com/docs/building-a-dbt-project/testing-and-documentation/testing/

But i can’t figure out how it should work. I have this example:

 columns: &columns
   - '"date"'
 models:
   - name: ga_data
     tests: 
       - not_null:
           column_name: *columns

But what i get is an error message:

 001003 (42000): SQL compilation error:
 syntax error line 3 at position 6 unexpected '['.

This is the SQL that is put into target/schema_test:

select count(*)
from XXXXXX.GOOGLE_ANALYTICS.ga_data
where ['"date"'] is null

Can you help me out?
Ultimately, I want to have an easy way of testing ALL columns in a model for not_null without have to retype everything for each column.

Hi @germanguy :wave:

Anchors can only be used for dictionaries, whereas here you’re using it for a list — check out this related issue on the Jinja library.

Hi claire, thanks for your help.
Did you post the correct link? This leads to an issues regarding “merge arrays” in the yaml github repo, which actually shows lists instead of dictionaries.
I found a link that explains it, https://docs.ansible.com/ansible/latest/user_guide/playbooks_advanced_syntax.html

Yep! The linked issue is a request for the functionality you’re trying to use, and the response basically being like “nah this won’t happen”