Singular tests

Singular tests are simple SQL queries that return failing records of a model or a resource. They are typically used for one-off checks or specific business rules that do not require reusability.

You can use Jinja functions like ref() and source() to make reference to the target resource.

For example:

-- In the payment model, check for payment with negative amount

select *
from {{ ref('payment') }}
where amount < 0

Create a singular test

To add a singular test to a model, open the Test case template and select the Custom SQL template: