I have a flatfile resources that were extracted into facts and dimensions. Some dimensions also comes from db resources. The transformation process is set on as needed basis (if there are new/updated from flatfiles). The problem is this, some data reference doesn't exist or match on the dimension based on db resources so the foreign key id value on the fact is set to default (zero if no matching data).
How can i perform an update on the facts if the said dimension (db resource) has been updated? What was the best practice/routine for this kind of scenario?
This is the sample illustration
Flatfile source product list (db source)
-------------------------------- ------------------------------
| product name | year | volume | | prodcode | name |
-------------------------------- ------------------------------
| apple | 2020 | 1000 | | 001 | apple |
| watermelon | 2020 | 2000 | | 002 | mango |
-------------------------------- ------------------------------
Fact/Dimension
production_fact dim_product
------------------------------- ---------------------------
| fk_product| fk_date| volume | | id | prodcode | name |
------------------------------- --------------------------|
| 2 | d001 | 1000 | | 1 | n/a | n/a |
| 1 | d001 | 2000 | | 2 | 001 | apple |
------------------------------- | 3 | 002 | mango |
---------------------------
If the product list will be updated (003 watermelon), should i replace the dim_product row#1 with the new value?