What you will be able to do
- Place data vault, 3NF-like and star schema models in the right medallion layer
- Explain why write-optimized models suit silver and read-optimized models suit gold
- Build gold-layer dimensions and facts with the dataset types and keys Databricks recommends
- Avoid the surrogate-key and constraint pitfalls that break fact-to-dimension joins
1.The medallion architecture as a map for data models
The medallion architecture organises lakehouse data into layers of increasing quality: bronze (raw), silver (validated) and gold (enriched). Data improves in structure and quality as it moves from Bronze to Silver to Gold. Databricks recommends this approach as a best practice, but it is not a requirement.
Each layer does a different job, and that job decides which data model belongs there. For analytical workloads, the key row of the Databricks comparison is *what happens in each layer*. Gold is the layer defined by dimensional modeling and aggregation, which is where star schemas live.
| Layer | What happens here | Typical users |
|---|---|---|
| Bronze (raw) | Raw data ingestion | Data engineers, data operations, compliance and audit teams |
| Silver (validated) | Data cleaning and validation | Data engineers, data analysts, data scientists |
| Gold (enriched) | Dimensional modeling and aggregation | Business analysts and BI developers, data scientists and ML engineers, executives, operational teams |
The gold layer holds refined, often aggregated datasets that map to business functions. You model it with a dimensional model by establishing relationships and defining measures. Because gold models a business domain, some organisations build more than one gold layer, for example for HR, finance and IT. Gold also holds pre-aggregated materialized views, so analysts don't have to rebuild common measures themselves.
CREATE OR REPLACE MATERIALIZED VIEW main.example_output.weekly_bookings AS
SELECT date_trunc('week', check_in) AS week,
property_id,
status,
count(*) AS total_bookings,
sum(total_amount) AS total_revenue
FROM samples.wanderbricks.bookings
GROUP BY week, property_id, statusCheckpoint 1 of 5· Check yourself
In the Databricks medallion architecture, which layer is characterised by dimensional modeling and aggregation?
Bronze is for raw ingestion and silver is for cleaning and validation. Gold is where dimensional models such as star schemas are built for reporting and analytics.
“using a dimensional model by establishing relationships and defining measures”Source: docs.databricks.com
Sources1
2.Data vault and normalized models in the silver layer
Data modeling often starts in the silver layer. Databricks lists several ways to represent nested or semi-structured data there, and one of them is to flatten the schema or normalize the data into multiple tables. The Databricks medallion blog describes silver as having more 3rd-Normal-Form-like models and names Data Vault-like, write-performant models as suitable for this layer. Gold then uses de-normalized, read-optimized models with fewer joins. That is where Kimball-style star schemas and Inmon-style data marts fit.
This resolves the apparent conflict with the advice to avoid 3NF. Normalized and data vault models optimise for writing and integrating data in silver. Star schemas optimise for analysts reading data in gold.
Limit of the sources: the provided Databricks material places data vault in the silver layer and calls it write-performant. It does not describe data vault's internal structure or how to build one on Databricks, so this lesson doesn't either.
Checkpoint 2 of 5· Match them up
Match each data model to the medallion layer where Databricks material places it
Tap a term, then the definition that fits it.
Silver favours 3NF-like and data-vault-like write-performant models. Gold favours de-normalized, read-optimized star schemas and data marts. Bronze is raw ingestion.
“Kimball style star schema-based data models or Inmon style Data marts fit in this Gold Layer”Source: www.databricks.com
Checkpoint 3 of 5· Exam question
A bank ingests customer and account data from a dozen source systems that change frequently as new product lines are added, and compliance requires a full, queryable audit trail of every historical value each attribute ever held. The data engineering team needs a Silver-layer design that absorbs source-system changes with minimal rework and preserves that history natively. Which modeling technique should they apply?
Correct answer: A — Data vault modeling, using hub tables for business keys, link tables for relationships, and satellite tables to capture time-stamped historical attributes.
- A. Data vault's hub, link, and satellite structure is purpose-built for this situation: hubs isolate stable business keys, links capture evolving relationships, and satellites record time-stamped attribute history, so new source systems and changing schemas can be absorbed without redesigning existing tables.
- B. A star schema optimized for dashboard reads is not designed for this requirement, and overwriting a denormalized dimension on every load discards the historical attribute values compliance needs to audit.
- C. Snowflake schemas normalize dimensions for storage efficiency in reporting, but they have no built-in mechanism for tracking every historical attribute change, so manual fact-table versioning would be needed and is not native to the pattern.
- D. A single flat table sourced from twelve rapidly changing systems would need constant redesign as source schemas evolve, and full reloads overwrite prior values instead of preserving the audit trail compliance requires.
3.Building the gold-layer star schema
A star schema puts one fact table of events and measures at the centre, joined by key to dimension tables of descriptive context. In Lakeflow pipelines it fits naturally at the gold layer. Bronze and silver handle ingestion and cleaning, and gold materializes the facts and dimensions that BI tools query directly. Databricks recommends a dataset type for each kind of table:
- Dimensions are materialized views built from cleaned silver data, one row per business entity. If you need history, use a streaming table with AUTO CDC and STORED AS SCD TYPE 2.
- Facts are streaming tables fed incrementally from silver, so aggregates stay close to real time.
- dim_date is a materialized view generated with sequence() and explode() over a date range. You don't ingest it from a source.
CREATE OR REFRESH MATERIALIZED VIEW dim_customer
COMMENT "Customer dimension"
AS SELECT customer_id, customer_name, region, signup_date
FROM customers_silver;Keys decide whether the star stays joinable over time. Prefer a stable natural key from the source, such as an order number, because it clusters and joins well. Use a surrogate key only when a source reuses or changes IDs. Even then, avoid hashes such as sha2(natural_key). A hash is deliberately random, so physically adjacent rows end up scattered across files, which hurts liquid clustering and Z-order performance. Instead, derive an order-preserving surrogate deterministically from the natural key, so it survives a full refresh. An IDENTITY column is only safe when the upstream table is append-only and never full-refreshed. A rebuild can give the same entity a new ID and silently break fact-to-dimension joins.
Finally, primary and foreign keys on Databricks are informational and not enforced. Declaring them documents the star's relationships, but it won't stop a fact row from pointing at a missing dimension row.
Checkpoint 4 of 5· Check yourself
A source system sometimes reuses customer IDs, so you need a surrogate key for dim_customer. Which approach does Databricks recommend?
A deterministic, order-preserving surrogate maps the same entity to the same key across rebuilds and keeps rows clustered. Hashes scatter rows. IDENTITY values can change after a full refresh.
“A hash is deliberately random, which is bad for liquid clustering and Z-order performance”Source: docs.databricks.com
Checkpoint 5 of 5· Check yourself
Which gold-layer dataset type does Databricks recommend for a fact table such as fact_orders?
Facts are built as streaming tables so gold aggregates stay near real time. Dimensions are usually materialized views, and sequence() with explode() is the pattern for dim_date.
“Keep facts as streaming tables and dimensions as materialized views unless you specifically need change history”Source: docs.databricks.com
It is static reference data and cheap to compute. Generating it as a materialized view over a date range also simplifies date-based joins and windowing across the rest of the model.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Hashing the natural key with sha2() is the best way to create a surrogate key for a dimension.Why is that wrong?
A hash is deliberately random, so adjacent rows scatter across files and liquid clustering and Z-order suffer. Use an order-preserving surrogate derived deterministically from the natural key.
Covered in Building the gold-layer star schema
2.An IDENTITY column is always a safe surrogate key for a dimension.Why is that wrong?
IDENTITY values are assigned at insert time. If the dimension is rebuilt or full-refreshed, the same entity can get a new ID and the fact-to-dimension joins break silently.
Covered in Building the gold-layer star schema
3.Declaring a foreign key from a fact table to a dimension stops orphan fact rows from being written.Why is that wrong?
Primary and foreign keys on Databricks are informational only. They document relationships but are not enforced.
Covered in Building the gold-layer star schema
4.Data vault is the recommended model for the gold reporting layer.Why is that wrong?
Databricks material places data-vault-like, write-performant models in silver. Gold uses de-normalized, read-optimized models such as star schemas.
Covered in Data vault and normalized models in the silver layer
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The terms bronze (raw), silver (validated), and gold (enriched) describe the quality of the data in each of these layers.”
↩︎ The medallion architecture as a map for data models“Following the medallion architecture is a recommended best practice but not a requirement.”
↩︎ The medallion architecture as a map for data models“some customers create multiple gold layers to meet different business needs, such as HR, finance, and IT.”
↩︎ The medallion architecture as a map for data models“It is common to start performing data modeling in the silver layer”
↩︎ Data vault and normalized models in the silver layer“Flatten schema or normalize data into multiple tables.”
↩︎ Data vault and normalized models in the silver layer“using a dimensional model by establishing relationships and defining measures”
↩︎ Checkpoint - 2.https://www.databricks.com/blog/what-is-medallion-architectureSecondary source
“From a data modeling perspective, the Silver Layer has more 3rd-Normal Form like data models.”
↩︎ Data vault and normalized models in the silver layer“Data Vault-like, write-performant data models can be used in this layer.”
↩︎ Data vault and normalized models in the silver layer“The Gold layer is for reporting and uses more de-normalized and read-optimized data models with fewer joins.”
↩︎ Exam trap 4“Kimball style star schema-based data models or Inmon style Data marts fit in this Gold Layer”
↩︎ Checkpoint - 3.
“In Lakeflow pipelines, the star schema fits naturally at the gold layer of the medallion architecture.”
↩︎ Building the gold-layer star schema“Only reach for a surrogate key (a pipeline-generated stand-in identifier) when a source reuses or changes IDs.”
↩︎ Building the gold-layer star schema“Build a dim_date as a simple materialized view generated with sequence() and explode() over a date range”
↩︎ Building the gold-layer star schema“A hash is deliberately random, which is bad for liquid clustering and Z-order performance”
↩︎ Exam trap 1“a rebuild can reassign different IDs to the same entity and silently break the fact-to-dimension joins”
↩︎ Exam trap 2“A hash is deliberately random, which is bad for liquid clustering and Z-order performance”
↩︎ Checkpoint“Keep facts as streaming tables and dimensions as materialized views unless you specifically need change history”
↩︎ Checkpoint - 4.
“Primary and foreign keys are informational and not enforced.”
↩︎ Building the gold-layer star schema“Primary and foreign keys are informational and not enforced.”
↩︎ Exam trap 3