Data governance
8 min

Data Quality Rules: Examples, and Why the Rule Has to Travel

Key takeaways

  • A data quality rule is a testable statement about a column or a table that returns pass or fail: a target, a condition, a threshold, and an action. Every tool writes one in a language it owns.
  • The five rules every programme writes are completeness, allowed values, referential integrity, a cross-column business rule, and membership of the concept. The first four have a syntax in every tool shown. The fifth has a syntax in one.
  • The allowed-values rule reads the same in DQDL, a Databricks expectation, a Snowflake data metric function, a Soda check, and a Great Expectations assertion: a column and a list. In SHACL it is a property of a thing in a model.
  • Informatica and Ataccama document a rule attached to a business term, so the question is what the definition is held as, what language the rule is written in, and whether it can leave on an open standard.
  • A SHACL shape targets the concept, carries the definition and its approver, validates on any conforming engine, and returns a report that is itself RDF. That is the rule that travels.
In this article
Share

A data quality rule is a testable statement about a column or a table that returns pass or fail. It names a target, a condition, a threshold, and an action on failure. Every quality tool on the market writes one the same way, in a rule language the tool owns. This post shows data quality rules examples in six of those languages, each quoted from the vendor's own documentation. Then it asks the question the examples pages skip: when the platform changes, what happens to the rule?

Five rules cover most of what a quality programme checks: completeness, allowed values, referential integrity, a cross-column business rule, and membership of the concept. The first four have a syntax in every tool below. The fifth has a syntax in one, because only one rule language sits on the model of what the column means. That is the rule that can leave the tool.

What is a data quality rule made of?

Four parts, in every language. Our post What Is Data Quality? covers the six dimensions a rule serves and the definition each one assumes.

The four parts of a rule

PartWhat it namesExample
TargetThe column or table the rule is aboutorder_id
ConditionThe boolean each row, or the whole table, must satisfyIs never null
ThresholdHow many failures still count as a passZero rows, or 99 percent
ActionWhat the engine does on failureWarn, drop the row, or fail the load

The Open Data Contract Standard, ODCS, writes the four into one YAML block. Its library example for order_id reads metric: nullValues, mustBe: 0, unit: rows (Bitol, ODCS, read 2026-11-27). The same page puts meaning somewhere else: "Authoritative definitions indicate the link to external definition." Our post Data Product vs Data Contract: A Contract Is Not a Definition follows that link.

What are the five data quality rules every programme writes, with examples?

Most programmes write the same five rules under different names. The first four each serve one of the six dimensions DAMA UK published in 2013, which DAMA-DMBOK carries. DAMA UK measures completeness against "Business rules which define what '100% complete' represents" (DAMA UK, 2013). The fifth rule is the one those business rules assume.

Five rules, in plain English

RulePlain EnglishDimension (DAMA UK, 2013)Measured against
Completenessorder_id is never nullCompletenessA business rule that says the field is required
Allowed valuessize is S, M, or LValidityThe permitted values in the field's definition
Referential integrityEvery zipcode exists in the reference tableConsistencyThe reference data set
Cross-column business ruleFare is positive whenever trip distance is positiveAccuracyThe business rule, written in prose
Membership of the conceptEvery row in customers is a customer as the business defines oneNone of the sixThe governed definition of a customer

Our post Data Quality Dimensions: The Six, and the One They All Assume takes the fifth row dimension by dimension. Here the question is which language can write it.

How does each tool write the allowed-values rule?

The allowed-values rule is the cleanest comparison. Every tool has one, and every version reads the same way: a column and a list. Each snippet below is quoted from the vendor's documentation, read on 2026-11-27.

One rule, six languages

AWS Glue DQDL. "Data Quality Definition Language (DQDL) is a domain specific language that you use to define rules for AWS Glue Data Quality" (AWS documentation).

ColumnValues "colA" in [ "a", "b", "c" ]

Databricks expectation. "Expectations are optional clauses in pipeline materialized view, streaming table, or view creation statements that apply data quality checks on each record passing through a query." Its documented example is a range (Databricks documentation, last updated 2026-11-13).

CONSTRAINT valid_customer_age EXPECT (age BETWEEN 0 AND 120)

Snowflake data metric function. "A DMF measures an attribute of your data such as how many NULL values exist in a column or how often a table is being updated" (Snowflake documentation). The allowed-values DMF (Snowflake documentation):

ALTER TABLE t1 ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.ACCEPTED_VALUES ON (age, age -> age = 5);

Soda check. "The checks in a Soda data contract are similar to unit tests for testing software." A column-level check in the contract YAML (Soda contract language reference).

- name: size
  checks:
    - invalid:
        valid_values: ['S', 'M', 'L']

Great Expectations assertion. "An Expectation is a verifiable assertion about data" (GX Core overview). From the 1.25.0 page on expectation conditions (GX documentation):

gx.expectations.ExpectColumnValuesToBeInSet(
    column="status",
    value_set=["unpaid", "partially_paid"],
    row_condition=row_condition,
)

SHACL shape. SHACL, the W3C Shapes Constraint Language, is "a language for validating RDF graphs against a set of conditions". Its sh:in constraint "specifies the condition that each value node is a member of a provided SHACL list" (W3C Recommendation, 20 July 2017). The specification's own example:

ex:InExampleShape
    a sh:NodeShape ;
    sh:targetNode ex:RainbowPony ;
    sh:property [
        sh:path ex:color ;
        sh:in ( ex:Pink ex:Purple ) ;
    ] .

Five of the six name a column in a table. The sixth names a property of a thing in a model, and the allowed values are themselves things in that model. Our post What Is SHACL? explains the language. Our post Data Quality vs Data Validation: Where the Rule Lives covers where each rule runs.

How do the tools write completeness, referential integrity, and a cross-column rule?

The other three value rules show the same split. Every cell is quoted from the page linked, read 2026-11-27.

Three more rules, by tool

ToolCompletenessReferential integrityCross-column rule
AWS Glue DQDL(IsComplete "id") and (IsUnique "id") (DQDL reference)ReferentialIntegrity "zipcode" "reference.zipcode" >= 0.9 (AWS)CustomSql "select id from primary where age < 100" (AWS)
SnowflakeSNOWFLAKE.CORE.NULL_COUNT ON (c1) (Snowflake)A user-defined DMF, referential_check, whose body is SELECT COUNT(*) FROM arg_t1 WHERE arg_c1 NOT IN (SELECT arg_c2 FROM arg_t2) (Snowflake)Any user-defined DMF
Microsoft PurviewAn "Empty/blank fields" rule type (Microsoft Learn, dated 2026-10-13)"Table lookup": "Confirms that a value in one table can be found in the specific column of another table."Row expression tripDistance > 0 AND fareAmount > 0. "Custom SQL rules in Microsoft Purview Data Quality don't support joins."
SHACLsh:minCount 1 on a property (W3C)sh:class ex:PostalAddress: "each value node is a SHACL instance of a given type"A SHACL-SPARQL constraint, Part 2 of the Recommendation

Three tools treat referential integrity as a lookup from one table into another. SHACL treats it as a type: the value has to be an instance of PostalAddress in the model.

Where does the rule live in the catalog-side products?

Four products put a catalog in front of the rule. Each is quoted from its own page, read on 2026-11-27.

Four catalog-side products, in their own words

  • Microsoft Purview. "Custom SQL rules in Microsoft Purview Data Quality provide a flexible way to define data quality checks using Spark SQL predicates." The page carries a banner: "existing data governance capabilities will remain in maintenance mode through November 12, 2027" (Microsoft Learn, dated 2026-10-13, updated 2026-11-12).
  • Collibra Data Quality & Observability. "Our MCP Server lets you run your data quality program from any large language model (LLM), turning Collibra assets like data contracts, policies and business rules into data quality checks without writing a single line of code" (Collibra product page, read 2026-11-27).
  • Informatica. Informatica documents a rule bound to a glossary term. "You can add a rule to a business term. The rule specifies the data conditions that the business term must satisfy to be valid in the organization. For example, you might define a rule for the business term "Mortgage" in a financial business glossary" (Informatica Data Engineering Quality 10.5.4 documentation, read 2026-11-27). The rule itself is a rule specification in the data quality application.
  • Ataccama. "Ataccama ONE acts as the single source of truth for governed, business-defined rules, enabling consistent reuse across your data landscape" (Ataccama, read 2026-11-27).

So a catalog-side product can bind a rule to a term, and two of the four say so in their own words. Three questions follow. What is the definition held as: a glossary entry, or a class in a model with its properties? What language is the rule written in: the product's own expression language, SQL, or a standard? And can the rule and the definition leave together, in a form another engine can run? No Purview, Collibra, Informatica, or Ataccama page read on 2026-11-27 names RDF, OWL, SKOS, SHACL, or SPARQL.

Why does the rule have to travel?

Three things happen to every rule. The platform under it is replaced. The rule is asked to run on a second platform. An auditor or an agent asks what the rule was testing for, and who agreed to it. A rule in a product's own language answers none of those.

Regulation now asks the third question in writing. Article 10 of the EU AI Act requires practices covering "the formulation of assumptions, in particular with respect to the information that the data are supposed to measure and represent" (Article 10(2)(d), artificialintelligenceact.eu, read 2026-11-27). A pass rate records that the values met the rule; the article asks for the assumption behind it. The regulation page, read on 2026-11-27, gives two application dates. High-risk systems under Annex III: 2 December 2027. High-risk systems under Annex I: 2 August 2028. Both cite Article 113(c). The dates moved during 2026; read the page before you plan against them.

Three tests a travelling rule passes

  • It targets the concept. The shape says which records qualify as a customer, as a class in a model, wherever the records are stored.
  • It carries its own meaning. The definition, the approver, and the review date sit in the same graph as the rule.
  • It runs anywhere and returns data. "The result of a validation process is an RDF graph with exactly one SHACL instance of sh:ValidationReport" (W3C, 2017).

That is the fifth rule from the examples table. In SHACL, "every row in customers is a customer" is a shape with sh:targetClass on Customer and a property constraint that requires at least one billed account. The same shape validates the Finance table and the Sales table, and says which rows are the thing the definition names. This is semantic data quality, or data quality measured against the governed meaning of the column. Cortés, Ehrlinger, Etcheverry, and Naumann "defined SHACL shapes for 69 data quality metrics proposed by Zaveri et al." (arXiv 2507.22305, ISWC 2025 workshop, v3 dated 2025-09-14).

Our post Metadata Quality: How to Measure It and What to Do About It already writes quality rules as SHACL shapes. Our post How to Validate an Ontology with SHACL walks through a run. Our post Data Quality Standards Compared: ISO 8000, DAMA, ODCS and SHACL lays the four standards side by side.

Where does TopQuadrant fit?

Keep your rule engine. It scores the values well. TQ Data Foundation holds the rule the scores assume: the SHACL shape on the governed definition, with the approver, the version, and the review date on the same record. SHACL is a standard TopQuadrant helped author. Policy-as-code, SHACL constraints, and validation rules run on the data, and validated data publishes automatically. AI proposes the first draft of a shape; your experts confirm it. Your catalog stays, and it syncs. Agents receive the definition, its relationships, and the rule over MCP, a Python SDK, and REST. Everything is RDF, SKOS, OWL and SHACL, exportable in full at any time.

Take the busiest rule in your engine and ask what it looks like outside the engine. If the answer is a screenshot, the rule has never travelled. TopQuadrant holds the version that does: a shape on the definition, in TQ Data Foundation.

Give your AI the context it's been missing

See how the TQ Data Foundation turns your enterprise knowledge into trusted, Al-ready context.