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: 

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-...

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!