Collect a dbplyr query, caching the result to a local parquet file.
Source:R/collect_cached.R
collect_cached.RdRuns the query the first time and writes the result to a parquet cache keyed on the query's SQL; later calls with the same query read the cache instead of re-scanning the lake. Big pulls page in slowly, so caching makes iterating on an analysis fast.
Usage
collect_cached(
query,
refresh = FALSE,
dir = getOption("ckdata.cache_dir", ".ckdata-cache")
)Arguments
- query
A lazy dbplyr query — typically a
lake_tbl()piped through dplyr verbs, e.g.lake_tbl("mart_responses") |> filter(...).- refresh
If
TRUE, ignore any cached result and re-run the query.- dir
Cache directory; defaults to the
ckdata.cache_diroption, or".ckdata-cache".