Skip to main content

Creating a Reusable Data Quality Rule

In addition to creating rule instances or writing custom SQL rules for specific use cases, you can also create reusable Data Quality rules that can later be assigned to any object (table, view, or column). This reduces duplication, ensures consistency, and makes it easier to manage your Data Quality setup.

info

To learn more about creating a rule instance or a custom SQL rule, visit their respective articles.

Who Can Create Reusable Rules

Only users with the Power Data Steward role assigned at the whole repository level can create reusable rules. This ensures that only authorized users can define queries that access real data across connected sources.

Entry Points

Before creating a reusable rule, you first need to open the creation form. You can do this from:

  • Data Governance → Data Quality → Rule instances tab and click Create rule instance → select Reusable rule
DQ reusable rule entry
DQ reusable rule popup
  • Data Governance → Data Quality → Reusable rules tab and click Create reusable rule
DQ reusable rules tab
  • Anywhere else where Data Quality is available (tables, data sources, columns, terms, domains, data products)

Step 1. Define the Rule

This step consists of three parts.

DQ reusable rule step 1

1a. Choose the Rule Scope

Start by selecting whether the rule will apply to:

  • Columns - for checks targeting specific fields.
  • Tables / Views - for checks that validate entire objects.

1b. Configure Null Handling (for column rules)

This switch defines how null values are handled in a rule:

  • Yes - when creating a rule instance, users will be able to decide whether nulls should be treated as errors. Rules with this option must use the null_values_filter parameter in their definition.
  • No - the rule definition itself decides whether nulls cause a failure. In this case, users have no choice at instance creation.

1c. Write the SQL Definition

Define the logic of your rule using a SQL-like query.

You can use:

  • Built-in parameters and functions that are automatically resolved based on the object the rule is assigned to.
  • Custom parameters you define, with values provided by the user at instance creation
info

See the full list of built-in parameters and functions to learn what’s available and how they are translated across databases.

Example

Suppose you want to create a reusable rule called "Value less than":

SELECT *
FROM {{ table_name }}
WHERE {{ null_values_filter }}
{{ column_name }} >= {{ value }}
  • table_name, column_name, and null_values_filter are built-in parameters and will be automatically substituted with the connected table, chosen column, and null-handling filter.
  • value is a custom parameter that you must define yourself.

Defining custom parameters

Below the Definition editor, add your custom parameters. For each parameter, specify:

  • Name - the exact identifier you used in the query (e.g., value).
  • Display name - how it will appear to end users when creating a rule instance or browsing results.
  • Type - String or Integer.
  • Description (optional) - guidance for end users on how to fill in the value correctly.

When a user creates a rule instance from this reusable rule, they will be prompted to provide a specific value for value (e.g., 100) that will be substituted into the query.

DQ reusable rule add parameter

Step 2. Save failed rows

In this step, you configure whether saving failed rows is possible for this rule.

  • If disabled, failed rows will never be saved for any instance of this rule.
  • If enabled, users creating a rule instance will be able to decide whether failed rows should be saved for that particular instance.

When saving is enabled:

  • Up to 1,000 failed rows will be stored each time the rule is executed on an object.
  • This makes it easier to review problematic data directly.
info

For some rules, such as checks on total row counts, saving failed rows may not make sense - either because there are too many or they cannot be identified precisely.

DQ reusable rule step 2

Step 3. Configure rule settings

Finally, configure the rule’s general settings:

  • Name – required; the rule’s identifier.
  • Description – optional, but recommended to help others understand the rule’s purpose.
  • Accepted data type – restricts which column types this rule can be assigned to:
    • Universal (usable across multiple data types)
    • Text
    • Date
  • Dimension – assign the rule to a dimension if applicable.
  • Library – a way to categorize rules. You can:
    • Type a new custom library name, or
    • Reuse an existing one.

Using libraries helps organize and tag similar rules for easier browsing later.

DQ reusable rule step 3

Managing Reusable Rules

You can review, edit, or remove your reusable rules at any time by navigating to:

Data Governance → Data Quality → Reusable rules

On this list, you will also find our built-in reusable rules.

  • These cannot be edited or removed.
info

Be careful when editing or removing reusable rules.
If a rule is already assigned to objects, any changes will directly affect related Data Quality checks and their results.

DQ reusable rules tab
Dataedo is an end-to-end data governance solution for mid-sized organizations.
Data Lineage • Data Quality • Data Catalog