DBT DBT Testing & Data Quality 1 — Questions and Answers
Question 1: Which built-in dbt generic test checks that all values in a column are unique?
- not_null
- unique (Correct answer)
- accepted_values
- relationships
Correct answer: unique
The `unique` generic test asserts that every row in a column has a distinct value.
Question 2: What dbt command runs all tests defined in your project?
- dbt compile
- dbt run
- dbt test (Correct answer)
- dbt check
Correct answer: dbt test
`dbt test` executes all schema and data tests and reports pass/fail results.
Question 3: Which YAML key is used to define generic tests on a column inside a schema.yml file?
- checks
- constraints
- tests (Correct answer)
- validations
Correct answer: tests
Under each column definition you add a `tests:` list to attach generic tests.
Question 4: A `relationships` test in dbt verifies what condition?
- Column values are not null
- Column values exist in a referenced model's column (Correct answer)
- Column values are unique
- Column data types match
Correct answer: Column values exist in a referenced model's column
The `relationships` test is a referential-integrity check ensuring every foreign-key value exists in the parent table.
Question 5: Which dbt package is the most widely adopted for extending the set of generic tests beyond the four built-in ones?
- dbt-expectations
- dbt-utils (Correct answer)
- dbt-audit-helper
- dbt-codegen
Correct answer: dbt-utils
`dbt-utils` ships dozens of reusable macros and generic tests such as `expression_is_true` and `recency`.
Question 6: How do you limit `dbt test` to only tests on a specific model named `orders`?
- dbt test --model orders
- dbt test --select orders (Correct answer)
- dbt test --filter orders
- dbt test --only orders
Correct answer: dbt test --select orders
The `--select` flag (or `-s`) accepts node selectors including model names, tags, and paths.
Which built-in dbt generic test checks that all values in a column are unique?