Bird
0
0

You want to ensure a column email in your users model has no nulls and all values are unique using dbt-utils tests. Which YAML snippet correctly applies both tests?

hard📝 Application Q15 of 15
dbt - Advanced Testing
You want to ensure a column email in your users model has no nulls and all values are unique using dbt-utils tests. Which YAML snippet correctly applies both tests?
Atests: - dbt_utils.not_null: email - dbt_utils.unique: email
Btests: - dbt_utils.not_null: columns: ['email'] - dbt_utils.unique: columns: ['email']
Ctests: - dbt_utils.not_null: - email - dbt_utils.unique: - email
Dtests: - dbt_utils.not_null: column_name: email - dbt_utils.unique: column_name: email
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct dbt-utils test syntax for columns

    dbt-utils not_null and unique tests expect column_name: email under the test name.
  2. Step 2: Evaluate each YAML snippet

    Snippet with column_name: email for both tests correctly uses the required key-value format. The snippet missing colons after tests is invalid YAML. Using a list - email passes incorrect config type. Using columns is invalid key.
  3. Final Answer:

    tests: - dbt_utils.not_null: column_name: email - dbt_utils.unique: column_name: email -> Option D
  4. Quick Check:

    column_name: [col] under test name [OK]
Quick Trick: Use column_name: email for not_null and unique tests [OK]
Common Mistakes:
MISTAKES
  • Omitting colon and using scalar email
  • Using list - email for single-column tests
  • Using wrong key columns instead of column_name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes