Skip to contents

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).

  • wave A character vector specifying the waves to filter on.

  • type A character vector specifying the types to filter on.

  • name A character vector specifying the names to filter on.

  • version A character vector specifying the versions to filter on.

  • batch A character vector specifying the batches to filter on.

  • source A 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 is TRUE.

verify

Logical. If TRUE, reads object back after upload and checks if identical to the input. Default is TRUE.

verbose

Logical. If TRUE, prints information about the process. Default is TRUE.

project

Character scalar defining the project name. If NULL, inferred from DESCRIPTION file (Package field).

env

Environment of the datalake to use. Must be "prod" or "test". Defaults to "prod". "prod" writes to g6tr-dl, "test" to g6tr-dl-test.

Value

Invisibly returns the full S3 key written.

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"
)
} # }