cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Medallion architecture, how to update Gold tables?

Mado
Valued Contributor II

Assume that I have a data source that is ingested to a few bronze tables, and transformed to a silver table. Ans next, a gold table is created by aggregating the silver table.

If new records arrive in the data source, bronze and silver tables are updated by appending new records. Since the gold table contains aggregated values, using "append" is meaningless.

I'd like to know which approach is recommended to update gold tables in case of having a large dataset:

1) Drop the current gold table, and re-create it

2) Overwrite the gold table

The first option seems to be slower if we deal with a large dataset. However, I'd like to know if there is any risk with option 2 (e.g. if the table is not overwritten correctly).

4 REPLIES 4

daniel_sahal
Esteemed Contributor

@Mohammad Saber​ 

Why not using MERGE? Or even CDF + Merge to do increments.

https://sarnendude.com/delta-lakes-change-data-feed-cdf-demo-in-azure-databricks/

Mado
Valued Contributor II

When there is aggregated value in the Gold table, I think it should be calculated using all records in the Silver table.

Anonymous
Not applicable

Hi @Mohammad Saber​ 

Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.

Please help us select the best solution by clicking on "Select As Best" if it does.

Your feedback will help us ensure that we are providing the best possible service to you. Thank you!

Mado
Valued Contributor II

Hi @Vidula Khanna​ 

The answer didn't fit my question.

In the case of using Merge, I found a good article here:

https://medium.com/@avnishjain22/simplify-optimise-and-improve-your-data-pipelines-with-incremental-...

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.