Recall & Review
beginner
What is a custom singular test in dbt?
A custom singular test in dbt is a user-defined check that runs a single SQL query returning zero or more rows. If the query returns any rows, the test fails. It helps validate specific data quality rules beyond built-in tests.
Click to reveal answer
beginner
How do you define a custom singular test in dbt?
You create a SQL file in the 'tests' directory with a query that returns rows when the test fails, typically named `<model_name>__<test_name>.sql`. dbt automatically runs it during `dbt test`.
Click to reveal answer
beginner
Example: What does this custom singular test do?
select * from {{ model }} where order_amount < 0This test checks if any orders have a negative amount. If any rows are returned, it means there are invalid negative order amounts, so the test fails.
Click to reveal answer
intermediate
Why use custom singular tests instead of built-in tests in dbt?
Custom singular tests let you check complex or unique business rules that built-in tests can't cover. They provide flexibility to enforce specific data quality needs.Click to reveal answer
beginner
Where do you place custom singular test SQL files in a dbt project?
Place them inside the 'tests' folder at the root or inside a subfolder like 'tests/custom'. This keeps tests organized and discoverable by dbt.
Click to reveal answer
What does a custom singular test in dbt return when it fails?
✗ Incorrect
A custom singular test returns rows when the test fails. If no rows are returned, the test passes.
Where should you place your custom singular test SQL files in a dbt project?
✗ Incorrect
Custom singular test SQL files belong in the 'tests' folder so dbt can find and run them.
Which of these is a reason to create a custom singular test?
✗ Incorrect
Custom singular tests are used to validate complex or unique business rules beyond built-in tests.
How do you run custom singular tests in dbt?
✗ Incorrect
'dbt test' runs all tests including custom singular tests.
What happens if a custom singular test query returns zero rows?
✗ Incorrect
If the query returns zero rows, it means no issues were found and the test passes.
Explain what a custom singular test is in dbt and how it works.
Think about how dbt knows a test passed or failed based on query results.
You got /5 concepts.
Describe the steps to create and use a custom singular test in a dbt project.
Consider both the file location and how dbt executes the test.
You got /5 concepts.