CertLumen

Databricks Data Analyst Associate · Section 4 · 20% of the exam

Create a materialized view, including knowing when to use Streaming Tables and Materialized Views, and differentiate between dynamic and materialized views.

One of the objectives of the Databricks Certified Data Analyst Associate exam, in the section “Executing queries using Databricks SQL and Databricks SQL Warehouses”. Here is what it covers, the points to remember and a question to try.

What it covers

Views, dynamic views, materialized views and streaming tables are all queried like tables, but they differ in what they store and when they compute. This lesson shows how to create a materialized view in Databricks SQL, how it refreshes, how it differs from standard and dynamic views, and when a streaming table is the better choice.

Points to remember

  • Standard views store only query text and recompute on every read, so they are always current.
  • Dynamic views use is_account_group_member(), current_user() or session_user() for row-level and column-level security; avoid is_member() with Unity Catalog.
  • Materialized views store precomputed results in a Unity Catalog managed table; refresh them manually, with SCHEDULE EVERY, SCHEDULE CRON or TRIGGER ON UPDATE.
  • In Databricks SQL, MVs and streaming tables need a pro or serverless warehouse; creation is synchronous and refreshes run on serverless pipelines.
  • Incremental MV refresh needs serverless compute and row tracking on the sources; REFRESH POLICY can be AUTO, INCREMENTAL, INCREMENTAL STRICT or FULL.

Try a question

Regional managers query one shared orders view. Each manager may see only the rows for the regions assigned to them in a mapping table, and only members of the finance group may see the margin column. Users must not need access to the base table. What should the analyst create?

  1. AOne materialized view per region, refreshed hourly, with SELECT on each granted to the matching managers
  2. BA dynamic view using current_user() with the mapping table and is_account_group_member('finance')
  3. CA standard view granted to the finance group, plus a second view without margin for everyone else
  4. DA temporary view that each manager creates in their own session with a WHERE clause for their regions
Show the answer

B. Dynamic views evaluate identity functions for the user running the query. A WHERE clause that checks the mapping table for current_user() restricts the rows, and CASE WHEN is_account_group_member('finance') THEN margin END masks the column. Granting SELECT on the view alone lets users query it without access to the base table.

Written for practice in the style of the exam: never a question from the real exam.

In the course

The lesson Views, Materialized Views and Streaming Tables teaches this objective (about 40 minutes), and 7 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.

More in this section

← Previous objective · All 39 objectives · Next objective →