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: 

APPLY AS DELETE without operation

smit_tw
New Contributor III

We are performing a full load of API data into the Bronze table (append only), and then using the APPLY CHANGES INTO query to move data from Bronze to Silver using Stream to get only new records. How can we also utilize the APPLY AS DELETE functionality with a condition to mark records as deleted when their corresponding ID no longer exists in the New Bronze Streaming data?

For example:

  • On Day 1, the Bronze table contains IDs: 1 to 5, and the Silver table will have IDs: 1 to 5.
  • On Day 2, the Bronze table contains IDs: 1 to 4 and 6.
    • In this case, the Silver table should add ID 6, and mark ID 5 as deleted (using the __END_AT field).

How can we achieve this behavior using APPLY CHANGES INTO in Databricks?

2 REPLIES 2

szymon_dybczak
Esteemed Contributor III

smit_tw
New Contributor III

@szymon_dybczak is it possible to do directly in Silver layer? We do not have option to go fo Gold layer. I tried to create a TEMP VIEW in Silver DLT pipeline but it gives error for circular dependency as I am comparing data from Silver it self and also creating it in same script. 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now