Exam dbt-Analytics-Engineering Topic 1 Question 61 Discussion

Actual exam question for dbt Labs's dbt-Analytics-Engineering exam
Question #: 61
Topic #: 1
You define a new generic test on model customers in a YAML file:
version: 2
models:
- name: customers
columns:
- name: customer_id
tests:
- unique
- not_null
The next time your project compiles you get this error:
Raw Error:
mapping values are not allowed in this context
in "<unicode string>", line 7, column 21
What is the cause of this error?

Suggested Answer: D Vote an answer

This error occurs because the YAML structure is incorrectly indented, causing dbt's parser (and YAML itself) to misinterpret the test definitions. In dbt, generic tests must be declared as a list under the tests: key, but YAML is extremely sensitive to indentation levels. In the faulty YAML, unique and not_null are indented incorrectly relative to the tests: key, which produces the error: "mapping values are not allowed in this context." According to the dbt Testing documentation, valid generic test syntax follows this exact pattern:
columns:
- name: id
tests:
- unique
- not_null
The indentation under tests: must be consistent and aligned so that YAML interprets the items as list elements, not as malformed mappings. When indentation is wrong, YAML attempts to parse list entries as key-value mappings, which leads to the error seen during compilation.
dbt does not require generic test names to be quoted, nor does it expect tests to be a dictionary. The test list format is correct-only the indentation is wrong. Therefore, the root cause is incorrect YAML indentation, making Option D correct.

by Sandy at Jan 02, 2026, 06:07 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10