<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Metric View Materialization Failure in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/metric-view-materialization-failure/m-p/177477#M57305</link>
    <description>&lt;P&gt;Hello &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/98941"&gt;@Avinash_Narala&lt;/a&gt;, I took a look at both internal and external documentation and here is what I found.&lt;/P&gt;
&lt;P&gt;What you're seeing is by design. A materialization is computed once, under the owner's identity, and then served to everyone. If the source returns different values depending on who's asking, the stored result would either leak the clear value or show the wrong one. Your screenshot shows &lt;CODE&gt;METRIC_VIEW_MATERIALIZATION_WITH_INVOKER_DEPENDENT_EXPRESSIONS_NOT_SUPPORTED&lt;/CODE&gt;, which fires when anything in the dependency chain uses functions like &lt;CODE&gt;current_user()&lt;/CODE&gt; or &lt;CODE&gt;is_account_group_member()&lt;/CODE&gt;. Row filters, column masks, and ABAC policies on the sources are blocked for the same reason. Masking the metric view itself isn't possible either: views don't accept column masks, and ABAC policies can't target metric views.&lt;/P&gt;
&lt;P&gt;So there's no switch for this. The fix is moving the masking to a different layer:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sanitize upstream. Build a de-identified table in your pipeline (hash, tokenize, or drop the PII columns), attach no masks to it, and point the metric view there. This is the cleanest route if your fields and measures don't need the raw values.&lt;/LI&gt;
&lt;LI&gt;Materialize first, mask on the way out. Build the metric view on an unmasked source so it materializes, then expose it through a dynamic view and revoke direct access to the metric view. The wrapper has to use &lt;CODE&gt;MEASURE()&lt;/CODE&gt; and a fixed set of dimensions, so you need one per query shape. Run &lt;CODE&gt;EXPLAIN EXTENDED&lt;/CODE&gt; to confirm queries through the wrapper still hit the materialization.&lt;/LI&gt;
&lt;LI&gt;Split by audience. Keep one materialized metric view without the sensitive field for general use and a second with the clear column for the privileged group, controlled by &lt;CODE&gt;SELECT&lt;/CODE&gt; grants.&lt;/LI&gt;
&lt;LI&gt;Stay unmaterialized and fix the timeout upstream. Pre-compute the expensive joins in a standalone materialized view, cluster it on your common filter columns, and put the column mask there with the &lt;CODE&gt;MASK&lt;/CODE&gt; clause. The mask is still enforced per user at query time. One caveat: a materialized view over sources that carry row filters or column masks always does a full refresh.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;A wrapper for the second option looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-sql"&gt;CREATE OR REPLACE VIEW catalog.schema.sales_secure AS
WITH agg AS (
  SELECT region, customer_email, MEASURE(total_revenue) AS total_revenue
  FROM catalog.schema.sales_metric_view
  GROUP BY ALL
)
SELECT
  region,
  CASE WHEN is_account_group_member('pii_readers') THEN customer_email ELSE '***' END AS customer_email,
  total_revenue
FROM agg;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the timeouts in the meantime, check the query profile to see where the time goes, and consider a larger SQL warehouse.&lt;/P&gt;
&lt;P&gt;References:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Materialization for metric views: &lt;A href="https://docs.databricks.com/aws/en/uc-semantics/metric-views/materialization" target="_blank"&gt;https://docs.databricks.com/aws/en/uc-semantics/metric-views/materialization&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Row filters and column masks: &lt;A href="https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/" target="_blank"&gt;https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;ABAC requirements and limitations: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/abac/requirements" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/abac/requirements&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Wrapper views over metric views: &lt;A href="https://docs.databricks.com/gcp/en/business-semantics/metric-views/bi-tools" target="_blank"&gt;https://docs.databricks.com/gcp/en/business-semantics/metric-views/bi-tools&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;CREATE MATERIALIZED VIEW: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you found this answer helpful please check off "Accept as Solutions" so that others can have confidence in the answer.&lt;/P&gt;
&lt;P&gt;Regards, Louis.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2026 19:49:27 GMT</pubDate>
    <dc:creator>Louis_Frolio</dc:creator>
    <dc:date>2026-11-24T19:49:27Z</dc:date>
    <item>
      <title>Metric View Materialization Failure</title>
      <link>https://community.databricks.com/t5/data-engineering/metric-view-materialization-failure/m-p/177466#M57301</link>
      <description>&lt;P&gt;While trying to develop metric view in databricks, I encountered with below error.&lt;/P&gt;&lt;P&gt;I am using &lt;SPAN&gt;&lt;STRONG&gt;a pii view&amp;nbsp;&lt;/STRONG&gt;toget a column&amp;nbsp;to build my final metric view, this is blocking on having the materialization to metric view because of masking functions used while building the pii view, without materialization any query on metric view is being timed out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I know there is a limitation "&lt;STRONG&gt;Materialization Doesn’t Support Column Masking and Row-Level Security" &lt;/STRONG&gt;but are there any workarounds on this? Because as metric views will be build using multiple semantic views and avoiding pii views will be inevitable when working in enterprise level.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Avinash_Narala_0-1795538949326.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/33684i25B7B84BF9AC8D15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Avinash_Narala_0-1795538949326.png" alt="Avinash_Narala_0-1795538949326.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2026 16:56:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/metric-view-materialization-failure/m-p/177466#M57301</guid>
      <dc:creator>Avinash_Narala</dc:creator>
      <dc:date>2026-11-24T16:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Metric View Materialization Failure</title>
      <link>https://community.databricks.com/t5/data-engineering/metric-view-materialization-failure/m-p/177477#M57305</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/98941"&gt;@Avinash_Narala&lt;/a&gt;, I took a look at both internal and external documentation and here is what I found.&lt;/P&gt;
&lt;P&gt;What you're seeing is by design. A materialization is computed once, under the owner's identity, and then served to everyone. If the source returns different values depending on who's asking, the stored result would either leak the clear value or show the wrong one. Your screenshot shows &lt;CODE&gt;METRIC_VIEW_MATERIALIZATION_WITH_INVOKER_DEPENDENT_EXPRESSIONS_NOT_SUPPORTED&lt;/CODE&gt;, which fires when anything in the dependency chain uses functions like &lt;CODE&gt;current_user()&lt;/CODE&gt; or &lt;CODE&gt;is_account_group_member()&lt;/CODE&gt;. Row filters, column masks, and ABAC policies on the sources are blocked for the same reason. Masking the metric view itself isn't possible either: views don't accept column masks, and ABAC policies can't target metric views.&lt;/P&gt;
&lt;P&gt;So there's no switch for this. The fix is moving the masking to a different layer:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Sanitize upstream. Build a de-identified table in your pipeline (hash, tokenize, or drop the PII columns), attach no masks to it, and point the metric view there. This is the cleanest route if your fields and measures don't need the raw values.&lt;/LI&gt;
&lt;LI&gt;Materialize first, mask on the way out. Build the metric view on an unmasked source so it materializes, then expose it through a dynamic view and revoke direct access to the metric view. The wrapper has to use &lt;CODE&gt;MEASURE()&lt;/CODE&gt; and a fixed set of dimensions, so you need one per query shape. Run &lt;CODE&gt;EXPLAIN EXTENDED&lt;/CODE&gt; to confirm queries through the wrapper still hit the materialization.&lt;/LI&gt;
&lt;LI&gt;Split by audience. Keep one materialized metric view without the sensitive field for general use and a second with the clear column for the privileged group, controlled by &lt;CODE&gt;SELECT&lt;/CODE&gt; grants.&lt;/LI&gt;
&lt;LI&gt;Stay unmaterialized and fix the timeout upstream. Pre-compute the expensive joins in a standalone materialized view, cluster it on your common filter columns, and put the column mask there with the &lt;CODE&gt;MASK&lt;/CODE&gt; clause. The mask is still enforced per user at query time. One caveat: a materialized view over sources that carry row filters or column masks always does a full refresh.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;A wrapper for the second option looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-sql"&gt;CREATE OR REPLACE VIEW catalog.schema.sales_secure AS
WITH agg AS (
  SELECT region, customer_email, MEASURE(total_revenue) AS total_revenue
  FROM catalog.schema.sales_metric_view
  GROUP BY ALL
)
SELECT
  region,
  CASE WHEN is_account_group_member('pii_readers') THEN customer_email ELSE '***' END AS customer_email,
  total_revenue
FROM agg;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the timeouts in the meantime, check the query profile to see where the time goes, and consider a larger SQL warehouse.&lt;/P&gt;
&lt;P&gt;References:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Materialization for metric views: &lt;A href="https://docs.databricks.com/aws/en/uc-semantics/metric-views/materialization" target="_blank"&gt;https://docs.databricks.com/aws/en/uc-semantics/metric-views/materialization&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Row filters and column masks: &lt;A href="https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/" target="_blank"&gt;https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;ABAC requirements and limitations: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/abac/requirements" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/abac/requirements&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Wrapper views over metric views: &lt;A href="https://docs.databricks.com/gcp/en/business-semantics/metric-views/bi-tools" target="_blank"&gt;https://docs.databricks.com/gcp/en/business-semantics/metric-views/bi-tools&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;CREATE MATERIALIZED VIEW: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you found this answer helpful please check off "Accept as Solutions" so that others can have confidence in the answer.&lt;/P&gt;
&lt;P&gt;Regards, Louis.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2026 19:49:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/metric-view-materialization-failure/m-p/177477#M57305</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2026-11-24T19:49:27Z</dc:date>
    </item>
  </channel>
</rss>

