CertSafari
    Databricks Certified Data Engineer Associate· Lessons

    Domain 3 · Lesson 15/33

    Gold layer objects in Unity Catalog: views, materialized views, streaming tables and tables

    Understand the difference between, and how to build, Gold layer objects such as materialized views, views, streaming tables, and tables for BI and analytics teams in Unity Catalog

    20 min read
    3.14% of exam
    8 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Explain what each medallion layer does and why gold holds aggregated datasets shaped for business consumers
    • Compare tables, views, materialized views and streaming tables by how they store data and when their results are computed
    • Create a gold materialized view, both on its own from Databricks SQL and inside a Lakeflow pipeline
    • Keep a materialized view fresh with SCHEDULE CRON, TRIGGER ON UPDATE or a manual REFRESH, and say when each one fits
    • Recognise when a streaming table is the wrong choice for a gold aggregation

    Key concept

    Storage and refresh behaviour of gold objects — Gold objects differ in two ways: whether they store results or only a query, and when those results are computed. A view stores only query text and computes on every read. A materialized view stores precomputed results and brings them up to date on refresh. A streaming table appends each new input row once. A table holds whatever data you write into it.

    1.Where gold sits in the medallion architecture

    The medallion architecture organises lakehouse data into three layers, and each layer leaves the data in better shape than the one before. Bronze holds raw data as it was ingested. Silver holds validated, cleaned data. Gold holds enriched data built for consumers. Databricks recommends the pattern but doesn't require it. People also call it a multi-hop architecture, because data moves from bronze to silver to gold.

    What each medallion layer does and who uses it
    LayerWhat happens thereIntended users
    BronzeRaw data ingestionData engineers, data operations, compliance and audit teams
    SilverData cleaning and validationData engineers, data analysts, data scientists
    GoldDimensional modeling and aggregationBusiness analysts and BI developers, data scientists and ML engineers, executives, operational teams

    Gold gets its input from silver, and silver is where the cleaning happens: schema enforcement, null handling, deduplication, type casting and joins. Those steps are covered in cleaning data into the silver layer. Gold then reshapes the clean data around business questions. It is often highly aggregated, filtered to particular time periods or regions, and modelled dimensionally with defined relationships and measures. Silver must keep at least one non-aggregated record of each row. Gold doesn't have to, and large amounts of history usually stay in silver instead of being copied into gold.

    A gold layer is usually small and frequently read. In the reference example, an ops.gold schema contains customer_spending (average and total spend per customer), account_performance (daily performance per account) and business_summary (highly aggregated figures for executives). That is fewer datasets than silver or bronze. Because gold models a business domain, some organisations build several gold layers, for example one each for HR, finance and IT. Dashboards and analysts query these datasets constantly, so tuning them for query performance is a best practice.

    A gold aggregate: weekly bookings and revenue, precomputed so analysts don't each recreate itsql
    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, status

    Checkpoint 1 of 9· Fill the gap

    Analysts and dashboards query this weekly gold aggregate constantly. It must store precomputed results so the aggregation doesn't rerun on every read. Which keyword completes the statement?

    CREATE OR REPLACE  ?  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, status

    Checkpoint 2 of 9· Match them up

    Match each medallion layer to the work done there

    Tap a term, then the definition that fits it.

    Sources1

    2.Tables, views, materialized views and streaming tables compared

    All four objects appear in Unity Catalog under a catalog.schema.name path. They differ in what they store and when they compute it. A view stores no data. It is a saved query, and every query against it reruns that logic over the underlying tables. That makes it free to store, and a good way to encapsulate business logic or present one consistent interface. It also means each read pays the full cost of the query. A materialized view is also defined by a query, but it precomputes the result and stores it. Reads are faster, at the cost of extra storage.

    The other two objects hold data directly. A table is the default Unity Catalog managed table. You change it yourself with INSERT, UPDATE, DELETE and MERGE INTO, and it has no defining query that keeps it current. A streaming table is a Unity Catalog managed table that carries its own processing logic in the form of flows. On each update, those flows read new data from a streaming source and append it.

    Storage and refresh behaviour of the four core objects
    ObjectStores results?When results are computedTypical gold use
    ViewNo, only the query textOn every queryEncapsulating logic or presenting a consistent interface without duplicating storage
    Materialized viewYes, precomputedOn refresh, often incrementallyPrecomputed aggregates behind dashboards and reports
    Streaming tableYesEach update appends newly arrived rows onceAppend-only, low-latency streaming transformations
    TableYesWhenever you write to it (INSERT, UPDATE, DELETE, MERGE INTO)Data you manage with your own write logic

    Creating a standard view in Unity Catalog needs USE CATALOG on the parent catalog plus USE SCHEMA and CREATE TABLE on the parent schema. You also need to be able to read every table the view references. On SQL warehouses and standard compute, Unity Catalog checks the view owner's permissions on the underlying data, so the owner must keep those grants for readers to keep access.

    A standard view over a raw sales table, created with a three-level namesql
    CREATE VIEW sales_metastore.sales.sales_redacted AS
    SELECT
      user_id,
      email,
      country,
      product,
      total
    FROM sales_metastore.sales.sales_raw;

    A temporary view cannot be a gold object. It isn't registered to any schema or catalog. In a notebook it disappears when the notebook detaches, and in Databricks SQL it exists only for a single query, so a dashboard has nothing persistent to point at. Global temp views are a legacy feature that Databricks recommends against.

    Checkpoint 3 of 9· Check yourself

    A finance team wants one shared gold object in Unity Catalog that wraps its revenue logic over a silver table. It must not duplicate any storage, every read must reflect the silver data as it is at that moment, and a dashboard must be able to point at it. Few people query it. Which object fits?

    Sources234

    3.Building a materialized view for BI

    Materialized views are the usual home for gold aggregates. Unlike a standard view, which recomputes on every query, a materialized view caches its result. When it refreshes, Databricks tracks what changed upstream and tries to process only that. In one example, 200 new customers arrive across three countries. A sales_report view grouped by country then updates three rows instead of rebuilding the whole report. When an incremental update isn't possible, Databricks recomputes the result from scratch, so the output is still correct, including for data that arrived late or out of order. That is why these views suit BI dashboards that need low query latency over current figures.

    There are two ways to build one, and the SQL keyword depends on which you use. A standalone materialized view is created from a Databricks SQL warehouse or serverless notebook with CREATE OR REPLACE MATERIALIZED VIEW. That statement blocks until the view exists and the initial data load finishes. Databricks then creates a serverless pipeline behind it, which appears under Jobs & Pipelines with type MV/ST. The person who creates the view owns it. Inside a Lakeflow pipeline, SQL source files define datasets with CREATE OR REFRESH. Python source files use the @dp.materialized_view decorator. Either way, the pipeline that defines a materialized view is the only one that can update it.

    Defining a materialized view in a pipeline with Python: the decorated function returns the join resultpython
    from pyspark import pipelines as dp
    
    @dp.materialized_view
    def regional_sales():
      partners_df = spark.read.table("partners")
      sales_df = spark.read.table("sales")
    
      return (
        partners_df.join(sales_df, on="partner_id", how="inner")
      )

    In pipeline SQL, the STREAM keyword in a SELECT reads its source with streaming semantics. That is how a streaming table is declared over incoming data. A materialized view over two silver tables leaves STREAM out: CREATE OR REFRESH MATERIALIZED VIEW regional_sales_mv AS SELECT ... with a plain join. Writing CREATE STREAMING TABLE ... FROM STREAM builds a different kind of object. CREATE TEMPORARY VIEW builds an unregistered view that doesn't persist. REFRESH doesn't define anything; it reruns a definition that already exists.

    Materialized views have known limits. Updates take seconds to minutes, not milliseconds. Some queries cannot be computed incrementally, and some input changes force a full recompute, which can be expensive. If the behaviour of a UDF used in the view changes in a way Databricks can't detect, for example because a library it calls was upgraded, you have to run the full refresh yourself. Materialized views also cannot be the source or target of a deep or shallow CLONE.

    Checkpoint 4 of 9· Check yourself

    For which of these gold-layer requirements would a materialized view be the wrong choice?

    Sources567

    4.Keeping a materialized view fresh: SCHEDULE, TRIGGER ON UPDATE and REFRESH

    A materialized view is only as current as its last refresh, so every gold materialized view needs a refresh plan. Standalone materialized views run only in triggered mode, so something has to start each refresh. Databricks offers three ways to do that: a time-based schedule, a trigger that fires when source data changes, and a manual command. The trigger comes from the view definition itself. To add a schedule to an existing view, you change its definition.

    TRIGGER ON UPDATE refreshes the view automatically whenever its upstream source tables change. Databricks recommends it for production workloads, especially when upstream jobs don't run on a predictable schedule. For example, if the silver orders table sometimes lands at 2 AM and sometimes at 5 AM, a fixed schedule either refreshes too early and serves stale numbers or wastes runs. An update-driven trigger avoids both.

    Refreshing whenever the source table is updatedsql
    -- Refresh automatically when the source table is updated.
    CREATE OR REPLACE MATERIALIZED VIEW mv_trigger
      TRIGGER ON UPDATE
    AS SELECT
      date,
      sum(sales) AS sum_of_sales
    FROM
      base_table1
    GROUP BY
      date;

    SCHEDULE fits when consumers expect numbers as of a fixed time, such as a revenue report that executives open every morning. SCHEDULE CRON takes a six-field Quartz expression (seconds, minutes, hours, day-of-month, month, day-of-week) and a time zone. Use ? in either the day-of-month or the day-of-week field to leave it unspecified. SCHEDULE EVERY covers simple fixed intervals. Expressions and aggregates in the SELECT must have aliases, which is why every computed column in the example below is named.

    A nightly CRON schedule at 3:30 AM UTC on a gold revenue aggregatesql
    -- Refresh nightly at 3:30 AM UTC.
    -- The cron expression uses six space-separated fields: seconds minutes hours day-of-month month day-of-week
    -- Use '?' for either day-of-month or day-of-week to leave it unspecified.
    CREATE OR REPLACE MATERIALIZED VIEW daily_revenue_by_region
      SCHEDULE CRON '0 30 3 * * ?' AT TIME ZONE 'UTC'
    AS SELECT
      date_trunc('day', order_time) AS sales_date,
      region,
      sum(revenue) AS total_revenue,
      count(*) AS order_count
    FROM
      orders
    GROUP BY sales_date, region;

    REFRESH MATERIALIZED VIEW mv1; refreshes on demand without restating the query. It blocks until the refresh finishes. Adding ASYNC returns control immediately. Only the owner and users who have been granted the REFRESH privilege can run it. Rerunning the original CREATE OR REPLACE statement also counts as a refresh. Whatever starts it, each refresh is either incremental, merging only rows that changed since the last update, or full, rerunning the whole query and replacing the stored result when incremental processing is impossible or not cost-effective.

    Checkpoint 5 of 9· Fill the gap

    Executives open this revenue report each morning and expect figures as of a fixed time. Which keyword sets up the nightly refresh at 3:30 AM UTC?

    -- Refresh nightly at 3:30 AM UTC.
    -- The cron expression uses six space-separated fields: seconds minutes hours day-of-month month day-of-week
    -- Use '?' for either day-of-month or day-of-week to leave it unspecified.
    CREATE OR REPLACE MATERIALIZED VIEW daily_revenue_by_region
       ?  CRON '0 30 3 * * ?' AT TIME ZONE 'UTC'
    AS SELECT
      date_trunc('day', order_time) AS sales_date,
      region,
      sum(revenue) AS total_revenue,
      count(*) AS order_count
    FROM
      orders
    GROUP BY sales_date, region;

    Sources6

    5.When a streaming table is the wrong gold object

    Streaming tables work on a different principle from materialized views: each input row is processed exactly once. They are built for append-only sources, which suits ingestion, where data arrives continuously and existing records must never be reprocessed. They also handle low-latency transformations over rows and time windows. Streaming tables can be defined in Lakeflow pipelines in SQL or Python, and they can also be created standalone. They are ordinary Unity Catalog managed tables that BI tools can query.

    Processing each row once is what makes streaming tables a poor fit for most gold aggregates. Once a row has been appended, later pipeline updates never query it again. Suppose a lifetime-value figure must be recalculated when a back-dated refund changes an earlier month. A streaming table has already written its earlier results and won't revisit them. Joins have the same problem. When a dimension changes, joins in a streaming table don't recompute, which gives fast-but-wrong results. A materialized view recomputes those joins, so its results stay correct.

    Changing a streaming table's query has a similar effect. Change SELECT LOWER(name) to SELECT UPPER(name) and only new rows come out uppercase, while existing rows keep the old logic. A full refresh is the only way to reprocess all earlier data. Streaming tables also need streams that are naturally bounded or bounded with a watermark. Without one, an unbounded stream can make the pipeline fail from memory pressure. If source records are updated or deleted rather than only appended, AUTO CDC applies those changes to a streaming table instead of appending them.

    Checkpoint 6 of 9· Check yourself

    A gold streaming table joins each incoming order to a customer dimension table to add the customer's region. Later, an analyst corrects one customer's region in the dimension table. What happens to that customer's order rows that the streaming table has already appended?

    Checkpoint 7 of 9· Exam question

    A data engineering team is building a gold-layer object that BI analysts will hit with dozens of ad hoc dashboard queries throughout the day. The object aggregates daily revenue by region from cleaned silver-layer order data, and analysts want dashboard queries to return quickly without each query recomputing the aggregation from scratch, while the underlying numbers should stay reasonably current as new orders arrive. Which type of Unity Catalog object should the team build for this gold-layer aggregation?

    Checkpoint 8 of 9· Exam question

    A junior data engineer proposes defining the gold-layer customer_lifetime_value object as a streaming table, reasoning that customers table updates frequently and a streaming table processes new records efficiently. The transformation logic recalculates lifetime value by aggregating a customer's full historical order history and applying corrections whenever late-arriving refund records are back-dated into earlier months. Why is a streaming table a poor fit for this specific gold-layer object?

    Checkpoint 9 of 9· Exam question

    Within a Lakeflow Spark Declarative Pipeline written in SQL, which statement correctly defines a gold-layer materialized view named regional_sales_mv from a join of two silver tables?

    Sources8

    Practise it for real

    Create a gold materialized view that refreshes on upstream changes, then refresh it manually without blocking.

    1. 1.In the SQL editor attached to a SQL warehouse, run CREATE OR REPLACE MATERIALIZED VIEW mv_trigger TRIGGER ON UPDATE AS SELECT date, sum(sales) AS sum_of_sales FROM base_table1 GROUP BY date; with base_table1 replaced by a table you can read.

      Why: TRIGGER ON UPDATE ties refreshes to changes in the source table instead of the clock.

      You should see: The statement blocks until the view is created and its initial data load finishes.

    2. 2.Open Jobs & Pipelines and add the Pipeline type column.

      Why: Every standalone materialized view gets a serverless pipeline that runs its refreshes.

      You should see: A pipeline for the view is listed with type MV/ST.

    3. 3.Run REFRESH MATERIALIZED VIEW mv_trigger ASYNC;

      Why: REFRESH reruns the existing definition without restating the query, and ASYNC returns control instead of blocking.

      You should see: The command returns immediately while the refresh runs in the background.

    Stuck? Get a nudge

    If the refresh is rejected, check that you own the view or have been granted REFRESH on it.

    Sources

    (8)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “The terms bronze (raw), silver (validated), and gold (enriched) describe the quality of the data in each of these layers.”
      ↩︎ Where gold sits in the medallion architecture
      “Gold layer data is often highly aggregated and filtered for specific time periods or geographic regions.”
      ↩︎ Where gold sits in the medallion architecture
      “Large amounts of historical data are typically accessed in the sliver layer and not materialized in the gold layer.”
      ↩︎ Where gold sits in the medallion architecture
      “What happens in this layer? | Raw data ingestion | Data cleaning and validation | Dimensional modeling and aggregation”
      ↩︎ Checkpoint
    2. 2.
      “Queries can run faster against materialized view than views, but take up extra storage.”
      ↩︎ Tables, views, materialized views and streaming tables compared
      “A streaming table is a type of Unity Catalog managed table that includes the processing logic using flows to define it.”
      ↩︎ Tables, views, materialized views and streaming tables compared
      “Tables, views, materialized views, and streaming tables are the core data objects for data engineering in Databricks, each with different storage and refresh behavior.”
      ↩︎ Key concept
      “Views are useful for simplifying complex queries, encapsulating business logic, and providing a consistent interface to the underlying data without duplicating storage.”
      ↩︎ Checkpoint
    3. 3.
      “A temporary view has limited scope and persistence and is not registered to a schema or catalog.”
      ↩︎ Tables, views, materialized views and streaming tables compared
      “Creating a view does not process or write any data. Only the query text is registered to the metastore in the associated schema.”
      ↩︎ Prediction
    4. 4.
      “You must have the USE CATALOG permission on the parent catalog and the USE SCHEMA and CREATE TABLE permissions on the parent schema.”
      ↩︎ Tables, views, materialized views and streaming tables compared
    5. 5.
      “They are always correct at the time of their update. All required data is processed, even if it arrives late or out of order.”
      ↩︎ Building a materialized view for BI
      “Tables defined by a pipeline can't be changed or updated by any other pipeline.”
      ↩︎ Building a materialized view for BI
      “Unlike standard views, which recompute results on every query, materialized views cache the results and refresh them on a specified interval.”
      ↩︎ Exam trap 1
      “They are not designed for low-latency use cases. The latency of updating a materialized view is in the seconds or minutes, not milliseconds.”
      ↩︎ Exam trap 4
      “They are not designed for low-latency use cases. The latency of updating a materialized view is in the seconds or minutes, not milliseconds.”
      ↩︎ Checkpoint
    6. 6.
      “Keeping a BI dashboard up to date with minimal end-user query latency.”
      ↩︎ Building a materialized view for BI
      “Use this approach for production workloads, especially when upstream dependencies don't run on predictable schedules.”
      ↩︎ Keeping a materialized view fresh: SCHEDULE, TRIGGER ON UPDATE and REFRESH
      “Standalone materialized views run only in triggered mode.”
      ↩︎ Keeping a materialized view fresh: SCHEDULE, TRIGGER ON UPDATE and REFRESH
      “If an incremental refresh can't be performed or is not cost-effective, the system runs the entire query”
      ↩︎ Keeping a materialized view fresh: SCHEDULE, TRIGGER ON UPDATE and REFRESH
      “You can also use the REFRESH MATERIALIZED VIEW statement to refresh the materialized view without needing to supply the query again.”
      ↩︎ Exam trap 3
    7. 7.
      “SQL code that creates pipeline datasets uses the CREATE OR REFRESH syntax to define materialized views and streaming tables against query results.”
      ↩︎ Building a materialized view for BI
      “The STREAM keyword indicates if the data source referenced in a SELECT clause should be read with streaming semantics.”
      ↩︎ Building a materialized view for BI
    8. 8.
      “Streaming tables are designed for append-only data sources and process inputs only once.”
      ↩︎ When a streaming table is the wrong gold object
      “Materialized views are always correct because they automatically recompute joins when dimensions change.”
      ↩︎ When a streaming table is the wrong gold object
      “A row that has already been appended to a streaming table will not be re-queried with later updates to the pipeline.”
      ↩︎ Exam trap 2
      “Joins in streaming tables do not recompute when dimensions change.”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.