DRDataRaft/ docs
GitHub ↗

dr_commons_yaml()

Export an explicit declarative definition for data-dict and commons

Usage

dr_commons_yaml(metric, table, sql_expr, path, expected_binding = NULL)

Arguments

metric
Registered metric definition for business metadata.


table
Physical table or governed product view name in the consumer environment.


sql_expr
Explicit single-table aggregate expression, e.g. SUM(reserve).


path
Output YAML file.


expected_binding
Optional hash from the returned path's definition_binding attribute, saved after independent SQL review. A changed metric, table or SQL expression fails before writing. This does not prove equivalence of the R and SQL computations.

Value

Path. This adapter exports metadata; it does not execute or install commons.

Examples

\dontshow{if (requireNamespace("yaml", quietly = TRUE)) withAutoprint(\{ # examplesIf}
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"
)
path <- tempfile(fileext = ".yml")
dr_commons_yaml(metric, "orders", "SUM(amount)", path)
cat(readLines(path), sep = "\n")
unlink(path)
\dontshow{\}) # examplesIf}
Documentation source snapshot · View source at 513e09e ↗
Code examples are documented source examples; they are not executed in this website build.

Search documentation

Search functions, packages and guides.