dr_tbl()
Query a published immutable data release
Usage
dr_tbl(src, ...)
\method{tbl}{dr_lake}(src, asset, release = NULL, ...)Arguments
- src
- Connected lake.
- ...
- Reserved for extensions.
- asset
- Asset id.
- release
- Release id; NULL selects latest.
Value
A lazy dbplyr table.
Examples
\dontshow{if (requireNamespace("duckdb", quietly = TRUE)) withAutoprint(\{ # examplesIf}
root <- tempfile("dataraft-example-")
config <- dr_lake_config(
dr_registry_duckdb(file.path(root, "lake.db")),
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)
dr_tbl(lake, "orders", release$release_id) |> dplyr::collect()
dataraft.lake::dr_disconnect_lake(lake)
unlink(root, recursive = TRUE)
\dontshow{\}) # examplesIf}Documentation source snapshot · View source at 113c179 ↗
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.