change_lake_items_metadata: Makes a batch change of the metadata applied to lake objects

View source: R/dev_tools.R

change_lake_items_metadataR Documentation

Makes a batch change of the metadata applied to lake objects

Description

[Experimental]

Batch changes of metadata can be usefule if there are hunderds or thousands of objects in the data lake which we need to change the metadata on.

Usage

change_lake_items_metadata(path, filter, new_metadata, mode, credentials)

Arguments

path

The path in the data lake which the objects are in

filter

A filter used to select the objects in the data lake which the metadata needs to be changed on.

new_metadata

A list type objects containing the new metadata to be applied on the lake objects.

mode

The mode to apply the metadata with. Can take the following values:

  • "overwrite": overwrites the entire existing metadata set with new_metadata

  • "merge": merges the new_metadata with the existing metadata

  • "add": only adds new variables from new_metadata to the existing metadata set

credentials

A list object containing your Hublot credential.

Examples

# To be documented

## Not run: 
 # get credentials from hublot
 credentials <- hublot::get_credentials(
   Sys.getenv("HUB3_URL"),
   Sys.getenv("HUB3_USERNAME"),
   Sys.getenv("HUB3_PASSWORD")
   )

 # filter for selecting the lakes items to be changed
 filter <- list(
   path = "political_party_press_releases",
   metadata__political_party = "CAQ",
   metadata__province_or_state="QC",
   metadata__country="CAN",
   metadata__storage_class="lake"
 )
 # new metadata

 # Change the metadata on the lake items complying with the filter
 clessnverse::change_lake_items_metadata(
   path = "political_party_press_releases",
   filter = list(
     metadata__province_or_state="QC",
     metadata__country="CAN",
     metadata__political_party="QS"
   ),
   new_metadata = list(
     "tags": "elxn-qc2022, vitrine_democratique, polqc",
     "format": "html",
     "source": "https://pq.org/nouvelles/lettre...",
     "country": "CAN",
     "description": "Communiqués de presse des partis politiques",
     "object_type": "raw_data",
     "source_type": "website",
     "content_type": "political_party_press_release",
     "storage_class": "lake",
     "political_party": "PQ",
     "province_or_state": "QC"
   ),
   mode = "merge",
   credentials = credentials
 )

## End(Not run)

clessn/clessn-verse documentation built on Feb. 18, 2024, 12:42 p.m.