Validations
Validations are rules created using SQL queries that check whether your queries are operating as expected. They are a powerful features to solve upstream issues that you might not have otherwise uncovered until it is too late.
In the editor of model select the Validations tab. Validations can only be added or edited if the validations model is in edit mode and assigned to the you.
#
Create a ValidationTo create a new validation select the add VALIDATION button. A window will appear with
The following sections are available to fill in:
#
NameSelect a name for your validation. There are a few rules to creating a name:
- No more than 32 characters long
- Use lowercase letters
- Use numbers but not as the first character
- Include underscores (ie. snake_case)
#
DescriptionA description of your validation.
#
TemplateSelect a template to use for building a validation. This is optional.
#
SQL EditorHere is where you write or edit the SQL query that defines the validation. The statement should validate a rule that is true or not.
GOLDEN RULE
If the SQL statement is true the validation will pass and so will the model. If the validation is false it will fail along with the model and pipeline and none of the dependent models will run either.
#
ExampleAn example of a validation is to ensure that the table is not empty.
Using the following SQL query will check whether the statement is true or not:
SELECT COUNT(*)>0FROM {{this}}
Saving the validation make it run the next time the model is run. You may add as many validations as you like by using the add VALIDATION button.
#
Monitoring the Validated ModelNavigate to the Monitoring section and select the pipeline and model task the validation is applied to. In the drop down section in the validations task the validation runs will appear once the model task has completed.
The following information is available:
#
Validation NameThe name of the validation.
#
SuccessTrue if the statement succeeded or False if it failed.
#
ErrorIf there is in error with running the validation (ie. the SQL statement failed to run) the error will display here.
#
Created AtThe timestamp that the validation run started.
#
Delete a ValidationTo remove a validation from a model simply tick off the delete check box and click save.