dbt-core
dbt-core copied to clipboard
[CT-908] Allow generic tests to accept arbitrary configs
Motivation: https://github.com/dbt-labs/dbt-snowflake/pull/210#discussion_r929104933
This is supported:
version: 2
models:
- name: my_model
config:
any_key: any_value
But this isn't:
version: 2
models:
- name: my_model
columns:
- name: id
tests:
- unique:
config:
any_key: any_value
I think it's because dbt only loads up the test's config
property with values from CONFIG_ARGS
:
https://github.com/dbt-labs/dbt-core/blob/3f54f303492b411a377f6724a9cfb685950b5de0/core/dbt/parser/generic_test_builders.py#L250-L262
Exit criteria: Tests' config
property should be able to accept any arbitrary key-value pairs, just like other resource types. Those configs can then be used to set runtime behavior, e.g. in a custom 'test'
materialization.
Will need to change the above for key in self.CONFIG_ARGS:
to loop through all the keys in the dict, and if it's CONFIG_ARGS it's adde dot the config and if it's not it's a keyword arg. Then we need to loop through the subdictionay config and save everything as a config.
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.