commit_mart_row: Write a row in a data table of a CLESSN data mart

View source: R/dev_t.R

commit_mart_rowR Documentation

Write a row in a data table of a CLESSN data mart

Description

[Experimental]

Usage

commit_mart_row(
  table_name,
  key,
  row = list(),
  refresh_data = FALSE,
  credentials
)

Arguments

table_name

The name of the data mart table to write an observation to without the 'chlub_tables_mart' prefix.

key

A character string containing the unique primary key of this observation in the table. Data integrity of the CLESSN data model is maintained by having a unique key per observation in each table.

row

A named list containing the observation to write to the datamart table. The names of the list are the columns of the table.

refresh_data

Logical.

credentials

The hublot credentials obtained from the hublot::get_credentials function

Value

returns a dataframe containing the data warehouse table with a JSON attribute as well as a document.id and creation & update time stamps

Examples

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


clessnverse::commit_mart_row(
  table_name = "political_parties_press_releases_freq",
  key = "QS212022",
  row = list(week_num=21, count=6, political_party="QS"),
  mode = "refresh",
  credentials = credentials)

## End(Not run)


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