dr_product()
Define a data delivery by name, its expected columns and its quality rules.
A product is a reusable specification. Bind a source with
dr_add_source(),
or supply data when executing a workflow. Use dr_run() before writing.
Usage
dr_product(
id,
data = NULL,
contract = NULL,
version = "1.0.0",
owner = NULL,
description = NULL,
code_version = NULL,
source_name = NULL,
execution = NULL,
contracts = NULL,
table = NULL
)Arguments
- id
- Product identity, unique within a dependency graph.
- data
- Optional table, path, source adapter, product, or successful run. Successful lake runs are pinned to their exact published release.
- contract
- Optional contract, named type vector or prototype list.
- version
- Optional immutable definition version. When omitted, lake publication derives a technical version from the definition.
- owner, description
- Optional metadata, otherwise inherited from contract.
- code_version
- Optional code and dependency version. Required only when
explicitly reusing a previously published lake release with
cache = TRUE. - source_name
- Optional name for
data. Defaults to the product ID for ordinary inputs, or the upstream product ID for a nested product. - execution
- Optional connection-free
dr_execution_config()stored on this definition. Used when it is the root ofdr_run(),dr_publish()ordataraft.lake::dr_ingest(). An explicit execution argument overrides these defaults. - contracts
- Named table contracts when data is a dm model.
- table
- Table name to select from a successful model trial or publication. Published selections retain the exact member release.
Value
A
product, ready for composition, inspection and execution.
Details
Add named sources, ordinary transformation functions and optional checks or
a target. Use
dr_run() to try it, or dr_publish() to save checked output.
dr_run() executes the full configuration, including writers. Products can be
sources of other products; shared dependencies run once per execution.
Table models
A table input defines a table product. A dm input defines a model product: its tables and declared relationships are checked together and published in one transaction. dr_collect() returns a dm; select a member explicitly with dr_product("report", result, table = "policies"). Model execution materializes all tables in memory. Table contracts are supplied through contracts.
Examples
orders <- dr_product("orders", data.frame(id = 1:2, amount = c(25, 75))) |>
dplyr::mutate(amount = round(amount, 2)) |>
dr_add_quality(~ amount >= 0)
orders |> dr_run(write = FALSE, stop_on_failure = FALSE) |> dr_collect()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.