DRDataRaft/ docs
GitHub ↗

dr_add_contract()

The contract describes shape and keys; quality rules describe acceptable values. Checks apply after preparation and gate framework writers. Adding a contract replaces the previous contract; NULL removes it. Quality rules accumulate.

Usage

dr_add_contract(x, contract)

dr_add_quality(
  x,
  quality,
  name = NULL,
  engine = NULL,
  action = NULL,
  threshold = NULL,
  dimension = NULL
)

Arguments

x
A dr_product() specification.


contract
Contract, named type vector, or named list of prototypes.


quality
One-sided row predicate, function, rule, or list of rules. Formula NA results count as failures. Functions return scalar logicals or dr_quality_counts(). Names in rule lists become rule names.


name
Optional quality rule name.


engine
Optional formula quality engine, "native" or "pointblank". Omit to preserve engines on existing rule specifications.


action
Optional publication policy: block, warn or quarantine. Quarantine removes every failing row before writing and retains it locally on the result. It supports native row formulas only. Standalone validation still blocks rejected rows until an execution path actually removes them.


threshold
Permitted fraction of failed test units, from zero to one. For quarantine, every rejected row is removed regardless of threshold.


dimension
Optional ODCS quality dimension.

Value

An updated product specification, without executing checks.

Examples

dr_product("orders") |>
  dr_add_contract(c(id = "integer", amount = "numeric")) |>
  dr_add_quality(~ amount >= 0)

See also

dr_contract(), dr_quality_rule(), dr_set_engine()
Documentation source snapshot · View source at d9cb454 ↗
Code examples are documented source examples; they are not executed in this website build.

Search documentation

Search functions, packages and guides.