Skip to main content
Validates that the values of a column or expression follow a rule. Use it for status codes and categories, numeric ranges, formats such as email addresses or IDs, and string lengths. This is a SQL data test: Elementary runs it against your warehouse on a schedule, with no SQL to write and no pull request.
SQL-based cloud tests read table data, so they need data access for the environment’s warehouse connection. Data access is enabled in one of two ways:
  • Elementary enables data access on the warehouse connection. Contact the Elementary team to turn it on.
  • You connect an Elementary Runtime to the warehouse connection.
Until data access is available, these tests are hidden from the test catalog.

How it works

On each run, Elementary returns every row whose value breaks the test’s rule. Each failing row is one table row, and the row sample contains the full rows.
  • One rule per test. To check several rules on the same field, for example a range and a regex, add a test for each rule. For combined logic, use a custom SQL test.
  • Nulls are ignored. A null value never breaks a validity rule. To require a value, add a completeness test.
Results count toward the Validity data quality dimension.

Rules

Validity test configuration with the Rule dropdown open, listing Allow list, Deny list, Range, Regex, and Length

Choosing the rule of a validity test

Regex patterns

A value matches when the pattern is found anywhere in it. To validate the whole value, anchor the pattern with ^ and $: Regex and length rules compare the value as text, so they also work on numeric columns.
Regular expression support differs between warehouses. Use standard syntax, such as character classes, anchors, and quantifiers, and run the preview to confirm the pattern behaves as expected on your warehouse.

Configuration

Severity, thresholds, sampled rows, and cadence work the same for all SQL data tests. See Configuration.

Examples

dbt equivalent

In dbt, these rules map to the accepted_values test and to package tests such as dbt_expectations.expect_column_values_to_be_between, expect_column_values_to_match_regex, and expect_column_value_lengths_to_be_between. See Cloud tests or dbt tests to decide which to use.