dwh_update_scd_type2: SCD Type 2

Description Usage Arguments Examples

View source: R/scd_etl.R

Description

Generate changes for a Slowly changing dimension type 2 (Add new rows)

Usage

1
2
dwh_update_scd_type2(current_dim, new_data, surrogate_key, natural_keys,
  scd_date = Sys.Date())

Arguments

current_dim

Current table, if a reference to a table in DWH, will download the entire table into R

new_data

The data you want to insert into the dimension

surrogate_key

The surrogate key you want to use, it has to be an integer column, and it has to be the first column in the table

natural_keys

The natural keys to use for joining the old data with the new data

scd_date

The date to insert, defaults to the current date

Examples

1
2
3
4
5
6
7
8
## Not run: 

cur_dim = dwh_query('select * from prod.dim_my_dimension')
new_data = mutate(cur_dim, bla=1)
changes = dwh_update_scd_type2(cur_dim, new_data, dim_key, c('business_key', 'business_key2'))


## End(Not run)

auth0/rauth0 documentation built on July 3, 2021, 4:11 p.m.