Have a question that is haunting me for some time.
How in practice looks replacing primary keys with surrogate keys during the ETL process? Like what is the workflow - is it just assigning new IDENTITY? If so, how about previous values, how to replace existing business keys with newly created ones?
In my mind a specific workflow looks like below, but I haven't done it in practice yet:
- Drop existing PK_Product and FK_Product in DimProduct and FactSales tables.
- Set a new IDENTITY column to dimProduct.
- Add new column to FactSales with values from newly created IDENTITY column based on join on previous business key.
- Drop an old ProductKey columns in both tables.
- Add constraints for newly created surrogate IDENTITY keys.
- Assign reference between tables for future-coming values.
But please tell me how you do this in your job and correct me, because I think I'm wrong.