Skip to content

Is Replica Of Check Examples

Deprecated: use Data Diff instead

The Is Replica Of rule is no longer maintained. Data Diff replaces it with the same row-by-row comparison plus change-type filtering. This page is kept as a reference for checks that already exist; new checks should use Data Diff.

One production scenario showing how an Is Replica Of check behaves when a replica drifts from its source. For new checks, the same scenario is better served by Data Diff.

The situation: A reporting replica of NATION is rebuilt nightly from the operational database. A failed load left the replica missing one row and holding a stale name on another. Row Identifiers are set on the primary key, so the anomaly can show which rows diverged.

Check configuration

Field Value
Rule Is Replica Of
Fields N_NATIONKEY, N_NATIONNAME
Filter (none)
Row Identifiers N_NATIONKEY
Passthrough Fields (none)
Reference Datastore reporting
Reference Container NATION_REPLICA
Comparators (none)
Owner (check creator)
Anomaly Assignee (Replication team)
Description Ensure NATION matches its replica.
Tags replication, legacy
Additional Metadata jira: DATA-9601
Status Active

Payload

{
    "description": "Ensure NATION matches its replica.",
    "rule": "isReplicaOf",
    "fields": ["N_NATIONKEY", "N_NATIONNAME"],
    "container_id": 145,
    "filter": null,
    "properties": {"ref_datastore_id": 22, "ref_container_id": 803, "id_field_names": ["N_NATIONKEY"]},
    "tags": ["replication", "legacy"],
    "additional_metadata": {"jira": "DATA-9601"},
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 12
}

Sample Data

N_NATIONKEY Source N_NATIONNAME Replica N_NATIONNAME
1 ARGENTINA ARGENTINA
2 BRAZIL BRASIL
3 CANADA (missing)

What gets flagged

Nation 2 carries a stale spelling in the replica and nation 3 never arrived. The check reports a single Shape Anomaly for the container; the Comparison Source Records view lists both rows side by side, which is what Row Identifiers make possible.

Shape Anomaly

For N_NATIONKEY, N_NATIONNAME, the referred fields do not replicate the targeted fields

Flowchart

graph TD
    A["Read both containers"] --> B["Pair rows on N_NATIONKEY"]
    B --> C{"Do the compared fields<br/>match on every paired row?"}
    C -->|Yes| D["Check passes"]
    C -->|No| E["Report one Shape Anomaly<br/>with the differing rows"]

Equivalent SQL

-- The rows an Is Replica Of check would surface.
SELECT s.n_nationkey, s.n_nationname AS source_name, r.n_nationname AS replica_name
FROM nation s
FULL OUTER JOIN nation_replica r ON s.n_nationkey = r.n_nationkey
WHERE s.n_nationname IS DISTINCT FROM r.n_nationname;

See Also