Serializes an R object and uploads it to AWS S3 in a standardized datalake structure. Handles entity and tag validation, deterministic S3 key construction, and environment selection.
Usage
dl_write(
x,
entity,
...,
format = "rds",
overwrite = TRUE,
verify = TRUE,
verbose = TRUE,
project = dl_get_project(),
env = "prod"
)Arguments
- x
Object to upload (tibble, model, or list).
- entity
Character scalar defining the entity path (e.g.
"data/srv_main").- ...
Named tag arguments (
tag = value).waveA character vector specifying the waves to filter on.typeA character vector specifying the types to filter on.nameA character vector specifying the names to filter on.versionA character vector specifying the versions to filter on.batchA character vector specifying the batches to filter on.sourceA character vector specifying the sources to filter on.
- format
File format to use for serialization. Must be
"rds". Placeholder for future formats. Default is"rds".- overwrite
Logical. If
FALSE, prompts before overwriting existing file. Default isTRUE.- verify
Logical. If
TRUE, reads object back after upload and checks if identical to the input. Default isTRUE.- verbose
Logical. If
TRUE, prints information about the process. Default isTRUE.- project
Character scalar defining the project name. If
NULL, inferred from DESCRIPTION file (Packagefield).- env
Environment of the datalake to use. Must be
"prod"or"test". Defaults to"prod"."prod"writes tog6tr-dl,"test"tog6tr-dl-test.
Examples
if (FALSE) { # \dontrun{
# Example: write to test datalake (recommended for experimentation)
dl_write(
x = mtcars,
entity = "data/srv_main",
wave = "wave1",
env = "test"
)
# With multiple tags
dl_write(
x = mtcars,
entity = "data/srv_main",
wave = "wave2",
project = "bastion",
env = "test"
)
} # }