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
5 REPLIES 5

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

Hi @Retired_mod ,

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