Exam dbt-Analytics-Engineering Topic 1 Question 4 Discussion
Actual exam question for dbt Labs's dbt-Analytics-Engineering exam
Question #: 4
Topic #: 1
Question #: 4
Topic #: 1
Choose whether these scenarios describe a test or a contract:


Suggested Answer:

Explanation:
1. Can only be defined on SQL models
The Answer:
contract
2. Errors are returned before the model is built
The Answer:
contract
3. May be configured to customize severity
The Answer:
test
4. May be run on ephemeral models
The Answer:
test
dbt tests and contracts serve different purposes in ensuring data quality and model correctness.
Tests evaluate data after it is produced, while contracts validate the structure of a model before dbt attempts to build it.
A model contract is schema-level enforcement that describes required columns, data types, and constraints.
Contracts can only be applied to SQL models, not Python or ephemeral models. Because contracts validate the model's schema before executing any SQL, dbt surfaces those errors before the model is built, preventing invalid schemas from being deployed.
In contrast, tests evaluate the data after dbt builds a model. Tests can be written generically (unique, not_null, relationships, accepted_values) or as custom SQL tests.
They run after the model is materialized. Tests also allow severity configuration, enabling warnings instead of failures for less critical issues-something contracts do not support.
Tests also run on ephemeral models, because dbt expands ephemeral SQL inline within downstream models, allowing tests to still execute logically against the resulting compiled SQL. Contracts, however, do not apply because ephemeral models never materialize into database objects.
Thus:
* "SQL-only" and "errors before build" # contract
* "custom severity" and "run on ephemeral models" # test
If you want the next question formatted the same way, send it!
by Shirley at Jan 18, 2026, 05:52 AM
0
0
0
10
Comments
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.
Report Comment
Commenting
You can sign-up / login (it's free).