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

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