scd2 table implementation in google bigquery

1.9k Views Asked by At

I am trying to create a SCD (slowly changing dimension) type 2 table in BigQuery without using any DML's

test schema :

id | date | name | valid_from | valid_to | flag

I need to capture the name changes for a specific id.

Thanks,

1

There are 1 best solutions below

0
On

You can create artificially date partitioned tables to achieve this. This way, each date's data is unique and can be accessed by `select distinct column from `dataset.table$yyyymmdd;` or for all the history, just do select distinct column from dataset.table;. Also, you can always overwrite/append to a given date's partition without harming others.