cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

DLT pipeline - SCD type 2

ksenija
Contributor
I created my table using SCD type 2 in SQL. I need to do full refresh to load all of the data. Whenever I update data in my source table, in my new table scd_target I see only the latest record, history is not being saved.
 
CREATE OR REFRESH STREAMING TABLE scd_target;
APPLY CHANGES INTO live.scd_target
FROM (
    SELECT id,
           name,
           surname,
           updated_at
    FROM stream(sources_test.sources_test.source)
) KEYS (name)
SEQUENCE BY updated_at
STORED AS SCD TYPE 2;
 
I need to use SQL since we are using it for other stuff in DLT pipeline
6 REPLIES 6

Rishabh-Pandey
Esteemed Contributor

hi @ksenija  i got your use case but could you please tell me , what do you mean by "sources_test.sources_test.source" 

Rishabh Pandey

Hi @Rishabh-Pandey ,

Those are my catalog, schema and external table

Kaniz_Fatma
Community Manager
Community Manager

Hi @ksenija, Thank you for reaching out to our community! We're here to help you.

To ensure we provide you with the best support, could you please take a moment to review the response and choose the one that best answers your question? Your feedback not only helps us assist you better but also benefits other community members who may have similar questions in the future.

If you found the answer helpful, consider giving it a kudo. If the response fully addresses your question, please mark it as the accepted solution. This will help us close the thread and ensure your question is resolved.

We appreciate your participation and are here to assist you further if you need it!

Hi @Kaniz_Fatma ,

I still don't have a solution for my problem, so I still don't want to close this conversation.

Best regards,

Ksenija

Rishabh-Pandey
Esteemed Contributor

@ksenija The logic which you were using is correct from my side , i am still wondering what this is happening so if possible can you please drop the checkpoints paths and tables and recreate the tables to check once or you can provide me with some screen shots if possible .

Rishabh Pandey

Hi @Rishabh-Pandey ,

I completely missed your message. At the end we decided not to use SCD 2, so I don't have any more data related to this query.

Thank you for your time!

Best regards,

Ksenija

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group