You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm fairly new to DBT so I apologize if this has been solved and I just haven't found it.
I have 20 tables with the same 100 columns. 99% of the tests are the same across all of them with a few exceptions.
Until YML 1.3 (maybe) allows merging of sequences, currently there's no good way to anchor and alias table columns that I know of.
tables:
- name: originalcolumns: &test_anchor
- name: thing1tests:
- accepted_values:
values: 1
- name: thing2tests:
- accepted_values:
values: 2
- name: thing3tests:
- accepted_values:
values: 3
- name: alias_exactly columns: *test_anchor # this will work if I want the tests to be exactly the same. # but if I want to overwrite the tests for thing3 (for an exception or addition)
- name: overwrite_thing3columns:
<<: *test_anchor # this doesn't work because it only gives me thing1 (the first column)
Proposal
If any thing that currently requires a sequence with a name key (tables, columns, etc), allow a map with the name value of the sequence as the key of said map (similar to but not the same as test_name in tests). I think the names are always required to be unique like maps anyway. If that were the case then we could do
And actually have it extend and overwrite the maps. I'm sure there was a reason for the sequence/name thing that I'm not getting. But figured I'd throw this out there.
I think this would go a long way into making the yaml's more DRY.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Problem
I'm fairly new to DBT so I apologize if this has been solved and I just haven't found it.
I have 20 tables with the same 100 columns. 99% of the tests are the same across all of them with a few exceptions.
Until YML 1.3 (maybe) allows merging of sequences, currently there's no good way to anchor and alias table columns that I know of.
Proposal
If any thing that currently requires a sequence with a
name
key (tables, columns, etc), allow a map with the name value of the sequence as the key of said map (similar to but not the same astest_name
intests
). I think thename
s are always required to be unique like maps anyway. If that were the case then we could doAnd actually have it extend and overwrite the maps. I'm sure there was a reason for the sequence/name thing that I'm not getting. But figured I'd throw this out there.
I think this would go a long way into making the yaml's more DRY.
Beta Was this translation helpful? Give feedback.
All reactions