FlashGenius Logo FlashGenius
Login Sign Up

dbt Analytics Engineering Certification (DBT-AE) Practice Questions: Testing and Data Quality Domain

Test your dbt Analytics Engineering Certification (DBT-AE) knowledge with 5 practice questions from the Testing and Data Quality domain. Includes detailed explanations and answers.

dbt Analytics Engineering Certification (DBT-AE) Practice Questions

Master the Testing and Data Quality Domain

Test your knowledge in the Testing and Data Quality domain with these 5 practice questions. Each question is designed to help you prepare for the DBT-AE certification exam with detailed explanations to reinforce your learning.

Question 1

You need to implement a custom test in dbt to ensure that no records in the `transactions` model have a negative `amount`. Which of the following code snippets correctly defines this custom test using `dbt_utils`?

A) ```yaml version: 2 models: - name: transactions tests: - dbt_utils.expression_is_true: expression: 'amount >= 0' ```

B) ```yaml version: 2 models: - name: transactions tests: - dbt_utils.not_null: field: amount ```

C) ```yaml version: 2 models: - name: transactions tests: - dbt_utils.unique: field: amount ```

D) ```yaml version: 2 models: - name: transactions tests: - dbt_utils.relationships: to: ref('transactions') field: amount to_field: amount ```

Show Answer & Explanation

Correct Answer: A

Explanation: The correct answer is A. The `dbt_utils.expression_is_true` test allows you to define a custom SQL expression that must evaluate to true for all rows, in this case, ensuring `amount >= 0`. Option B tests for non-null values, which does not address the requirement for non-negative amounts. Option C tests for uniqueness, which is unrelated to the given requirement. Option D incorrectly uses a relationships test, which is intended for referential integrity checks between models. For more on custom tests, see the [dbt-utils documentation](https://github.com/dbt-labs/dbt-utils#expression_is_true-source).

Question 2

You have a dbt model that processes a large volume of data daily. To optimize performance, you decide to implement incremental processing. Which configuration should you use in the model file to enable incremental updates, assuming your source table has a column `updated_at` that tracks changes?

A) ```sql {{ config( materialized='incremental', unique_key='id' ) }} SELECT * FROM {{ source('my_schema', 'my_table') }} ```

B) ```sql {{ config( materialized='incremental', unique_key='id', incremental_strategy='merge' ) }} SELECT * FROM {{ source('my_schema', 'my_table') }} WHERE updated_at > (SELECT MAX(updated_at) FROM {{ this }}) ```

C) ```sql {{ config( materialized='table' ) }} SELECT * FROM {{ source('my_schema', 'my_table') }} ```

D) ```sql {{ config( materialized='view' ) }} SELECT * FROM {{ source('my_schema', 'my_table') }} ```

Show Answer & Explanation

Correct Answer: B

Explanation: The correct answer is B. Incremental models in dbt are configured with `materialized='incremental'` and often use an `incremental_strategy` such as `merge` to handle updates. The SQL query filters data using a condition like `WHERE updated_at > (SELECT MAX(updated_at) FROM {{ this }})` to only process new or changed records. Option A lacks the necessary filtering logic for incremental updates. Options C and D configure the model as a full table or view, respectively, which do not support incremental processing. For more guidance, refer to the [dbt documentation on incremental models](https://docs.getdbt.com/docs/building-a-dbt-project/building-models/configuring-incremental-models).

Question 3

You need to create a test in dbt to ensure that a column in your model only contains unique values. Which of the following is the correct way to implement this test?

A) Use a custom SQL query within a dbt test file.

B) Create a test using the `unique` test macro in the `schema.yml` file.

C) Write a Python script to check for uniqueness and run it as a dbt operation.

D) Add a unique constraint to the database table directly.

Show Answer & Explanation

Correct Answer: B

Explanation: To ensure that a column contains unique values, you should use the `unique` test macro in the `schema.yml` file. This is the standard way to define column-level tests in dbt, leveraging built-in test macros for data validation. Option A is incorrect because dbt provides built-in test macros, and custom SQL is unnecessary for this common test. Option C is incorrect because dbt operations are not used for testing. Option D is incorrect as it involves database-level changes outside of dbt's testing framework. Refer to the [dbt documentation on tests](https://docs.getdbt.com/docs/building-a-dbt-project/tests) for more information.

Question 4

In your dbt project, you want to ensure that the `customer_id` column in the `customers` model is both unique and non-null. Which of the following configurations in `schema.yml` will achieve this?

A) ```yaml version: 2 models: - name: customers columns: - name: customer_id tests: - unique ```

B) ```yaml version: 2 models: - name: customers columns: - name: customer_id tests: - not_null ```

C) ```yaml version: 2 models: - name: customers columns: - name: customer_id tests: - unique - not_null ```

D) ```yaml version: 2 models: - name: customers tests: - unique: customer_id - not_null: customer_id ```

Show Answer & Explanation

Correct Answer: C

Explanation: Option C is correct because it applies both `unique` and `not_null` tests to the `customer_id` column within the `columns` section, ensuring the column is both unique and non-null. Option A only ensures uniqueness, and Option B only ensures non-null values. Option D incorrectly applies the tests at the model level rather than the column level. For more information, refer to the [dbt documentation on schema testing](https://docs.getdbt.com/docs/building-a-dbt-project/tests).

Question 5

You are troubleshooting a dbt model that is taking longer than expected to run. Upon inspection, you find that the model uses a lot of complex transformations in the Jinja macros. Which of the following strategies could help optimize the model's performance?

A) Refactor the Jinja macros to SQL expressions where possible.

B) Increase the complexity of Jinja macros to reduce SQL processing.

C) Add more Jinja macros to abstract SQL logic.

D) Remove all Jinja macros and write raw SQL only.

Show Answer & Explanation

Correct Answer: A

Explanation: Option A is correct because refactoring Jinja macros into SQL expressions can improve performance by leveraging the database's native SQL processing capabilities, which are typically more efficient than Jinja processing. Option B is incorrect because increasing Jinja complexity can further degrade performance. Option C is incorrect because adding more Jinja macros can introduce additional overhead. Option D is incorrect because while removing Jinja might simplify the SQL, it also removes the benefits of templating and reusability. For best practices, refer to the [dbt documentation on Jinja and SQL](https://docs.getdbt.com/docs/building-a-dbt-project/jinja-context).

Ready to Accelerate Your dbt Analytics Engineering Certification (DBT-AE) Preparation?

Join thousands of professionals who are advancing their careers through expert certification preparation with FlashGenius.

  • ✅ Unlimited practice questions across all DBT-AE domains
  • ✅ Full-length exam simulations with real-time scoring
  • ✅ AI-powered performance tracking and weak area identification
  • ✅ Personalized study plans with adaptive learning
  • ✅ Mobile-friendly platform for studying anywhere, anytime
  • ✅ Expert explanations and study resources
Start Free Practice Now

Already have an account? Sign in here

About dbt Analytics Engineering Certification (DBT-AE) Certification

The DBT-AE certification validates your expertise in testing and data quality and other critical domains. Our comprehensive practice questions are carefully crafted to mirror the actual exam experience and help you identify knowledge gaps before test day.

Other Practice Tests: