commit_mart_table: clessnverse::commit_mart_table

View source: R/dev_t.R

commit_mart_tableR Documentation

clessnverse::commit_mart_table

Description

[Experimental]

commit_mart_row allows the programmer to write a tabe as a CLESSN data mart.

Usage

commit_mart_table(table_name, df, key_column, mode, credentials)

Arguments

table_name

The name of the data mart table to store without the 'chlub_tables_mart' prefix.

df

blah

key_column

blah

mode

A character string cintaining either "refresh" or "append". If mode = "refresh" then if an observation with a key = key already exists in the table, it will be overwritten with the new values. If mode = "append" then it will be added to the table. However if an existing observation with a key = key already exists in the table, a warning will be returned.

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

 # Writes a data frame into political_parties_press_releases_freq
  datamart  <- clessnverse::commit_mart_table(
  table_name = 'political_parties_press_releases_freq',
  df = data.frame(key = "123", count = 1, week_num = "28", party = "CAQ"),
  key_column = 'key',
  mode = 'add',
  credentials = credentials)

## End(Not run)


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