1

I want to implement SCD type 2 in databricks, I know this can be handled with MERGE. But I have historical data which is appended and am not sure how to implement SCD type 2 since the target table is empty as its initial load sample of my data.

ID Name
1 A
2 B
1 A2
3 C
3 C2

Now how do implement SCD type 2 since target table is empty as its initial load.

Please do explain me with example.

TylerH
21.3k85 gold badges84 silver badges122 bronze badges
asked Jul 27, 2024 at 10:07

1 Answer 1

0

You could either load the records in age order and in separate load runs - which is is unlikely to be practicable for large data volumes - or you manually create the SCD records for your historic data and then insert them into your target

answered Jul 27, 2024 at 15:41
Sign up to request clarification or add additional context in comments.

2 Comments

Can you please let me know with an example how to manually create an SCD records for historical data?
Not without having some sample data. Also, as I'm afraid this is not a free code writing service, you would also need to show an attempt at doing this yourself. I suggest that if you get stuck you create a new post showing sample data, the result you want to achieve, the SQL you've managed to write and explain precisely what issue you are facing

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.