This function deletes all data related to specified projects (or other metadata filters)
from the data lake across the given layers. It first lists the matching objects using
dl_ls(), displays the files to be deleted, and then prompts the user for confirmation
before proceeding with the deletion.
Usage
dl_rm(
entity = NULL,
...,
layer = NULL,
verbose = FALSE,
prompt = TRUE,
limit = Inf,
project = dl_get_project(),
env = "prod"
)Arguments
- entity
Optional character vector defining one or more entities (e.g.
"data/srv_main"). IfNULL, lists all entities.- ...
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.
- layer
Optional character vector of layers (e.g.
"data","models"). IfNULL, includes all layers.- verbose
Logical. If
TRUE, prints informational messages. Default isTRUE.- prompt
Logical. If
TRUE(the default), the user is prompted for confirmation before deletion proceeds.- limit
An integer specifying the maximum number of objects to delete. Default is
Inf.- project
Character scalar or vector defining one or more projects. If omitted, inferred from
DESCRIPTION. IfNULL, lists across all projects.- env
Environment of the datalake to use (
"prod"or"test"). Defaults to"prod"."prod"=g6tr-dl,"test"=g6tr-dl-test.
Details
The function first retrieves all matching objects from the S3 bucket "g6tr-datalake"
using dl_ls() with the provided filters, including any extra filters passed via ....
It then displays the list of objects (including their sizes, if available) and prompts
the user for confirmation before deleting each object.
Examples
if (FALSE) { # \dontrun{
# Remove all data for project "project1" across all layers
dl_rm(project = "project1")
# Remove data for "project1" and "project2" from the "fzl" and "lzl" layers
dl_rm(project = c("project1", "project2"), layer = c("fzl", "lzl"))
# Remove objects with extra metadata region equal to "NA"
dl_rm(layer = "fzl", region = "NA")
} # }