The problem I’m having
I am running a dbt built in test named accepted_values for a column and i am giving the name for the test.
However when running dbt compile, i am getting below error : macro ‘dbt_macro__test_accepted_values’ takes no keyword argument ‘name’.
The name argument is the name of the test in the schema.yml file.
- name: <column_name>
description: <desc>
tests: #Defining the accepted values
- accepted_values:
name: <test_name>
values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Some example code or error messages
macro 'dbt_macro__test_accepted_values' takes no keyword argument 'name'
> in macro test_accepted_values (tests/generic/builtin.sql)
You need to provide the exact YAML definition including spacing of your test, because this is almost certainly a YAML problem
Note: @Mike Stanley
originally posted this reply in Slack. It might not have transferred perfectly.
hi @a_slack_user , thanks for your help. Please see the above.
Hmm and I see that you did actually do that and Discourse just didn’t render the code block for me, it popped in after I pressed enter! Tests do not actually have a name property, so where you have name: <test_name>
in your YAML, this isn’t valid. If you look at the example here(https://docs.getdbt.com/reference/resource-properties/tests), it has a name
property but it is a property of the column, not of the test. So the name
is getting passed to your test macro and this is causing an error.
Yes I agree that tests should have names and it’s pretty infuriating that they don’t… but they don’t I’m afraid.
Note: @Mike Stanley
originally posted this reply in Slack. It might not have transferred perfectly.
Hi @a_slack_user , I beleive one can provide custom name for a test as mentioned here About tests property | dbt Developer Hub in the same link that you provided.