dr_report_release()
Reports preserve double precision. Nested list columns are rejected before
writing; expand them into named atomic columns in the metric calculation.
Report JSON stores numeric values. Integer64 columns must stay within
-2^53 to 2^53 inclusive so saved values can be read back exactly. Larger
integers are rejected before writing; retain those individual results
in a storage format with integer64 support.
Usage
dr_report_release(
lake = NULL,
id,
results = NULL,
code_version,
params = list(),
to = NULL
)Arguments
- lake
- For data-first use, the measurement results. Also accepts a connected lake, lake configuration or local lake folder for lake-first use.
- id
- Immutable report release id.
- results
- Named list of measure results, or a measurement set.
- code_version
- Reporting code version.
- params
- Report parameters.
- to
- Report destination. When omitted in data-first use, inferred from matching saved lake references on every result. Supplied connections remain open; internally opened connections always close.
Value
Report manifest including result values as data frames, both on
initial save and an identical retry. Retries preserve original timestamps.
Examples
\dontshow{if (requireNamespace("dataraft.lake", quietly = TRUE) && requireNamespace("duckdb", quietly = TRUE)) withAutoprint(\{ # examplesIf}
root <- tempfile("dataraft-example-")
config <- dataraft.lake::dr_lake_config(
dataraft.lake::dr_registry_duckdb(file.path(root, "lake.db")),
dataraft.lake::dr_storage_local(file.path(root, "data")),
landing = file.path(root, "landing"), backend = "duckdb"
)
lake <- dataraft.lake::dr_connect_lake(config)
path <- file.path(root, "orders.csv")
utils::write.csv(data.frame(order_id = 1:2, amount = c(25, 75)), path,
row.names = FALSE)
source <- dataraft.core::dr_source_file("orders.file", path, reader = utils::read.csv)
contract <- dataraft.core::dr_contract(
"orders", version = "1.0.0", columns =
c(order_id = "integer", amount = "numeric"), key = "order_id"
)
release <- dataraft.core::dr_product("orders", contract = contract, code_version = "v1") |>
dataraft.core::dr_add_source(source) |> dataraft.core::dr_publish(to = lake)
metric <- dr_metric(
"orders.total", "orders", expr = sum(amount), time_behavior = "flow",
unit = "EUR", owner = "Analytics", description = "Total order value",
approved = TRUE, code_version = "v1"
)
values <- dr_measure(lake, metric)
dr_report_release(lake, "report.v1", list(total = values), code_version = "v1")
dataraft.lake::dr_disconnect_lake(lake)
unlink(root, recursive = TRUE)
\dontshow{\}) # examplesIf}Documentation source snapshot · View source at 513e09e ↗
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.