Study guide
4.3 Silver and Gold Medallion Layer Refinement
Databricks Certified Data Engineer Professional Exam
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Developing Code for Data Processing using Python and SQL - Core Spark SQL & PySpark
1.1 Complex PySpark Transformations & DataFrame API 1.2 Advanced Spark SQL Patterns 1.3 Streaming Workloads with Structured Streaming 1.4 Lakeflow & Delta Live Tables (DLT) Declarative Pipelines
2 Chapter 2: Developing Code for Data Processing using Python and SQL - Streaming & Advanced Patterns
2.1 Advanced Delta Lake Features 2.2 Custom & Stateful Streaming Operations 2.3 Python & PySpark Code Modularization 2.4 User-Defined Functions (UDFs) & Performance Impact
3 Chapter 3: Data Ingestion & Acquisition
3.1 Auto Loader (cloudFiles) Production Ingestion 3.2 Change Data Capture (CDC) Ingestion Patterns 3.3 Batch & Streaming Connectors
4 Chapter 4: Data Transformation, Cleansing, and Quality
4.1 Data Validation & Quality Frameworks 4.2 Data Cleansing, Deduplication & Standardization 4.3 Silver and Gold Medallion Layer Refinement 4.4 Handling Schema Drift and Evolution
5 Chapter 5: Data Sharing and Federation
5.1 Delta Sharing Architecture & Governance 5.2 Lakehouse Federation
6 Chapter 6: Monitoring and Alerting & Observability
6.1 System Tables & Observability 6.2 Databricks Workflows & Job Monitoring 6.3 Spark UI & Query Execution Diagnostics 6.4 Data Quality & Pipeline Alerting
7 Chapter 7: Cost & Performance Optimisation - Data Layout & Compute
7.1 Data Storage & Layout Optimization 7.2 Compute Choice & Cluster Sizing 7.3 Photon Engine & Query Acceleration
8 Chapter 8: Cost & Performance Optimisation - Skew & Cost Governance
8.1 Partitioning & Data Skew Remediation 8.2 Cost Governance & DBU Optimization
9 Chapter 9: Ensuring Data Security and Compliance
9.1 Unity Catalog Access Control & Least Privilege 9.2 Dynamic Data Masking & Row/Column-Level Security 9.3 Secrets Management & Network Security 9.4 Compliance, Audit & Data Privacy
10 Chapter 10: Data Governance in Unity Catalog
10.1 Unity Catalog Governance Architecture 10.2 Data Lineage & Tagging in Unity Catalog 10.3 Managed vs External Tables & Storage Governance
11 Chapter 11: Debugging and Deploying - Asset Bundles & CI/CD
11.1 Databricks Asset Bundles (DABs) & Infrastructure as Code 11.2 CI/CD Automation & Databricks CLI / REST API 11.3 Troubleshooting Pipeline & Job Failures 11.4 Code Versioning & Databricks Git Integration
12 Chapter 12: Data Modelling & Lakehouse Analytics
12.1 Medallion Architecture Design Patterns 12.2 Dimensional Modeling in the Lakehouse 12.3 Analytics & BI Optimization
4.3 Silver and Gold Medallion Layer Refinement
Key Takeaways Explain This Topic AI
The Medallion Architecture organizes data into Bronze (raw landing), Silver (cleansed, deduplicated, enriched), and Gold (aggregated business KPIs, star-schema ready) layers.
Transitions between layers can be implemented using batch jobs or Structured Streaming; streaming provides lower latency and native checkpointing for incremental processing.
Idempotent pipelines ensure that running the same data transformation process multiple times produces the exact same final state without duplicating data.
Gold layer tables are frequently modeled as materialized views or dimensional star schemas to optimize query performance for BI tools and executive dashboards.
Optimizing MERGE INTO operations for the Silver layer often requires leveraging partition pruning and predicate pushdown to avoid full table scans.
Last updated: July 2026
The Medallion Architecture is a fundamental data design pattern deeply intertwined with the Databricks Lakehouse paradigm. It logically organizes data into distinct layers—Bronze, Silver, and Gold—representing progressive levels of structure, cleanliness, quality, and business value. Understanding the technical implementations, architectural trade-offs, and advanced MERGE patterns involved in transitioning data through these layers is a heavily weighted topic on the Databricks Data Engineer Professional exam.
The Journey from Bronze to Silver
The Bronze layer serves as the raw landing zone. Data here is typically ingested in its original, native format (such as JSON, CSV, or Parquet) with minimal to no transformations applied. It acts as an immutable historical archive, allowing data engineers to replay history if downstream pipelines require modification or rebuilding. In Bronze, the schema might be loosely inferred, and corrupt records are preserved using permissive read modes to ensure zero data loss from upstream sources.
The transition from Bronze to the Silver layer involves heavy lifting and complex transformations. The Silver layer represents a cleansed, validated, deduplicated, and normalized "single source of truth" for the enterprise. It is generally modeled around core business entities (e.g., Customers , Transactions , Inventory ) rather than the raw application event streams.
Key operations performed during the Bronze-to-Silver transition include:
Deduplication: Removing duplicated events generated by at-least-once message brokers using dropDuplicates() or Window functions.
Schema Enforcement: Explicitly defining and enforcing schemas to prevent corrupt data from propagating.
Data Cleansing: Standardizing strings, handling nulls appropriately, and standardizing timezones to UTC.
Enrichment: Joining disparate reference data tables (e.g., joining an orders stream with a static customer_reference table to append region IDs).
The Journey from Silver to Gold
The Gold layer is highly optimized for downstream analytics, reporting, and Machine Learning at scale. While Silver provides high-quality atomic data, Gold provides highly refined, aggregated, and business-ready data tailored for specific use cases.
Key operations in the Silver-to-Gold transition include:
Aggregations: Calculating sums, averages, and complex group-by metrics (e.g., daily_revenue_by_region ).
Dimensional Modeling: Restructuring the normalized Silver data into highly efficient Star Schemas (Fact and Dimension tables) optimized for BI tools like PowerBI or Tableau.
Materialized Views: In Databricks SQL or Delta Live Tables, Gold tables are frequently implemented as Materialized Views. This allows the engine to precompute complex aggregations and efficiently refresh only the changed data incrementally, vastly improving query performance.
Advanced MERGE Patterns
A critical component of Medallion pipelines is efficiently updating Delta tables using the MERGE INTO operation. Unlike simple appends, MERGE allows for complex upsert logic, handling inserts, updates, and deletes in a single atomic transaction.
When updating a Silver table with new data from Bronze, you typically merge on a primary key. Understanding the performance implications of MERGE is vital. For large tables, a MERGE can be expensive because it requires a full table scan to find matching records unless optimized.
To optimize MERGE operations, engineers should utilize predicate pushdown . By adding a date or partition filter to the MERGE condition, Spark can skip scanning irrelevant files. -- Optimized MERGE using partition pruning
- MERGE INTO silver.transactions AS target
- USING new_transactions AS source
- ON target.transaction_id = source.transaction_id
- AND target.date >= current_date() - interval 7 days -- Partition pruning predicate
- WHEN MATCHED AND source.status = 'CANCELLED' THEN
- DELETE
- WHEN MATCHED THEN
- UPDATE SET *
- WHEN NOT MATCHED THEN
- INSERT *
In PySpark, the equivalent DeltaTable API allows for programmatic merges, which is heavily used in Structured Streaming foreachBatch sinks.
Streaming vs. Batch Transitions and Architectural Trade-offs
Databricks allows transitions between Medallion layers to be executed via Batch processing or Structured Streaming . A modern best practice is to utilize Structured Streaming even for batch-like workloads.
Streaming is increasingly preferred because PySpark Structured Streaming automatically manages state and incremental data processing via checkpoints . When transitioning from Bronze to Silver via a stream, Spark tracks exactly which files in the Bronze layer have been processed. This completely eliminates the need for data engineers to write custom, error-prone "high-water mark" logic to identify new data.
The Power of Trigger.AvailableNow
A major architectural trade-off in streaming is balancing latency against compute costs. Running a cluster 24/7 for a continuous stream provides sub-second latency but incurs high costs. For many Silver and Gold tables, hourly or daily updates are perfectly acceptable.
To solve this, Databricks provides the Trigger.AvailableNow (which supersedes the older Trigger.Once ) setting. This spins up the cluster, processes all new data that has arrived since the last checkpoint in a series of optimized micro-batches, commits the Delta transaction, and then shuts the cluster down automatically. This combines the robust incremental tracking benefits of streaming with the exceptional cost efficiency of scheduled batch jobs.
Designing Idempotent Pipelines
A critical requirement for robust data engineering tested on the exam is idempotency . An idempotent pipeline guarantees that executing the same transformation logic multiple times against the same source data will result in the exact same final target state, without causing data duplication, corruption, or side effects.
Idempotency is crucial for handling job failures, retries, and backfilling data. If a pipeline fails midway through writing to a Silver table, a retry must safely overwrite or accurately merge the data without creating double-entries.
Strategies to ensure idempotency include:
Using Delta Lake MERGE: As discussed, merging based on primary keys inherently prevents duplicate inserts.
Overwrite Operations: For smaller dimension tables or daily aggregations in the Gold layer, completely overwriting the specific date partition ensures the state is perfectly reset to the correct baseline upon every retry.
Streaming Checkpoints: Structured Streaming ensures exactly-once processing semantics natively when writing to Delta Lake sinks, guaranteeing strict idempotency even if the stream crashes and restarts abruptly.
Understanding how to orchestrate these layers, optimize merges, and ensure idempotency is the hallmark of a professional Databricks Data Engineer.