dbt relationship test compilation error: test definition dictionary must have exactly one key
dbt relationship test compilation error: test definition dictionary must have exactly one key
我是dbt的新用户,正在尝试写一个关系测试:
- name: PROTOCOL_ID
tests:
- relationships:
to: ref('Animal_Protocols')
field: id
我收到这个错误:
Compilation Error
Invalid test config given in models/Animal_Protocols/schema.yml:
test definition dictionary must have exactly one key, got [('relationships', None), ('to', "ref('Animal_Protocols')"), ('field', 'id')] instead (3 keys)
@: UnparsedNodeUpdate(original_file_path='model...ne)
同一文件中的“unique”和“not-null”测试工作正常,但我对“accepted_values”有类似的错误。
我在 MacOS Big Sur 11.6 上使用 dbt cli 版本 0.21.0 和 Snowflake。
你很亲近!我 96% 确定这是一个缩进问题——使用 YAML 的第一大痛点。解决方案是 to
和 field
都需要在 relationships
键下方缩进,而不是在同一级别。
查看 Tests dbt docs page 示例
- name: PROTOCOL_ID
tests:
- relationships:
to: ref('Animal_Protocols')
field: id
我是dbt的新用户,正在尝试写一个关系测试:
- name: PROTOCOL_ID
tests:
- relationships:
to: ref('Animal_Protocols')
field: id
我收到这个错误:
Compilation Error
Invalid test config given in models/Animal_Protocols/schema.yml:
test definition dictionary must have exactly one key, got [('relationships', None), ('to', "ref('Animal_Protocols')"), ('field', 'id')] instead (3 keys)
@: UnparsedNodeUpdate(original_file_path='model...ne)
同一文件中的“unique”和“not-null”测试工作正常,但我对“accepted_values”有类似的错误。
我在 MacOS Big Sur 11.6 上使用 dbt cli 版本 0.21.0 和 Snowflake。
你很亲近!我 96% 确定这是一个缩进问题——使用 YAML 的第一大痛点。解决方案是 to
和 field
都需要在 relationships
键下方缩进,而不是在同一级别。
查看 Tests dbt docs page 示例
- name: PROTOCOL_ID
tests:
- relationships:
to: ref('Animal_Protocols')
field: id