dr_quality_reference()
The rule counts input rows without a matching reference key. Duplicate
reference keys do not multiply results. Missing key values fail by default,
including when the reference also contains a missing value. Use
na_matches = "na" to match missing values deliberately.
Usage
dr_quality_reference(
reference,
by,
name = "reference",
copy = FALSE,
na_matches = c("never", "na"),
action = NULL,
threshold = NULL
)Arguments
- reference
- A data frame, lazy table, source adapter, or zero-argument function returning one. Source adapters manage their own connections.
- by
- Character vector of key columns, or a named vector mapping input
columns to reference columns, for example
c(customer_id = "id"). - name
- Name of the quality check.
- copy
- Explicitly permit moving reference keys between backends.
- na_matches
- Whether missing values never match (
"never", default) or match other missing values ("na"). - action, threshold
- See
dr_quality_rule().
Value
A quality rule accepted by
dr_add_quality() or dr_contract().
Details
Checks between lazy tables on the same database run as aggregate queries.
Moving reference keys between backends requires
copy = TRUE; this may
collect all distinct reference keys and upload them to the input backend.
Only the mapped key columns are copied. No data rows are included in quality
evidence or contract metadata. References are resolved again on each run;
cached publication is unsuitable for a reference that can change separately.
Examples
customers <- data.frame(id = c("a", "b"))
orders <- data.frame(customer_id = c("a", "missing", NA))
rule <- dr_quality_reference(customers, c(customer_id = "id"))
dr_run_quality(rule, orders)Documentation source snapshot · View source at d9cb454 ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.