Internal function to update portions of cached arrow files.
Usage
cache_update(
x,
table_name,
depth,
type,
primary_keys = cache_get_attributes(x)$primary_keys,
date_column = NULL,
delete = FALSE,
incremental = TRUE,
prefer = "to",
...
)
Arguments
- x
data.frame or part of a data.frame to be cached
- table_name
string
- depth
string, e.g. "deep" or "shallow"
- type
string, e.g. "tessi" or "stream"
- primary_keys
character vector of columns to be used for identifying rows when updating the cache
- date_column
character name of the column to be used for determining the date of last row update
- delete
whether to delete rows in cache missing from
x
, default is not to delete the rows- incremental
whether or not to update the cache incrementally or to simply overwrite the existing cache, default is
TRUE
.- prefer
"from" or "to": which table to prefer on conflict during a date-only update. The default is to prefer the destination table, so that existing data in
to
is not overwritten.- ...
extra arguments passed on to arrow::write_dataset
Examples
if (FALSE) { # \dontrun{
x <- data.table(a = 1:1000, b = runif(1000))
y <- data.table(b = 100:199, b = runif(100))
cache_write(x, "test", "deep", "stream")
cache_update(y, "test", "deep", "stream")
} # }