<?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 Row Level Security while streaming data with Materialized views in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/row-level-security-while-streaming-data-with-materialized-views/m-p/80411#M36009</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I have the following problem when trying to add row level security to some of our Materialized views. According to the documentation this feature is still in preview - nevertheless, I try to understand why this doesnt work and how it would be supposed to to work once the feature is live.&lt;/P&gt;&lt;P&gt;So there is a lot of differences when comparing the SQL statements in Notebooks, SQL Editor and DLT. If I run the following query in notebooks it will fail:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE materialized view test_rowfilter
WITH ROW FILTER gold.cost_center_filter on (CostCenter)
AS
select
    *
from bronze.some_table&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same query will work for some random reason in SQL editor though.&lt;/P&gt;&lt;P&gt;If I change the first line to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE OR REFRESH MATERIALIZED VIEW &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the SQL Editor will fail, but the query will work in DLT assuming I removed the Row Filter clause. According to the docs, everything should just work but it doesnt.&lt;/P&gt;&lt;P&gt;You can try and reproduce this by just playing around with the "OR REFRESH" and "WITH ROW FILTER" statements. You will get a large variety of different error messages depending on the location of where you test it. I wonder why such a feature is even in preview state.&lt;/P&gt;&lt;P&gt;Am I misunderstanding something here maybe?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our goal would be to have the Query as CREATE OR REFRESH and WITH ROW FILTER running inside of a DLT pipeline.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2024 15:50:58 GMT</pubDate>
    <dc:creator>Splush</dc:creator>
    <dc:date>2024-07-24T15:50:58Z</dc:date>
    <item>
      <title>Row Level Security while streaming data with Materialized views</title>
      <link>https://community.databricks.com/t5/data-engineering/row-level-security-while-streaming-data-with-materialized-views/m-p/80411#M36009</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I have the following problem when trying to add row level security to some of our Materialized views. According to the documentation this feature is still in preview - nevertheless, I try to understand why this doesnt work and how it would be supposed to to work once the feature is live.&lt;/P&gt;&lt;P&gt;So there is a lot of differences when comparing the SQL statements in Notebooks, SQL Editor and DLT. If I run the following query in notebooks it will fail:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE materialized view test_rowfilter
WITH ROW FILTER gold.cost_center_filter on (CostCenter)
AS
select
    *
from bronze.some_table&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same query will work for some random reason in SQL editor though.&lt;/P&gt;&lt;P&gt;If I change the first line to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE OR REFRESH MATERIALIZED VIEW &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the SQL Editor will fail, but the query will work in DLT assuming I removed the Row Filter clause. According to the docs, everything should just work but it doesnt.&lt;/P&gt;&lt;P&gt;You can try and reproduce this by just playing around with the "OR REFRESH" and "WITH ROW FILTER" statements. You will get a large variety of different error messages depending on the location of where you test it. I wonder why such a feature is even in preview state.&lt;/P&gt;&lt;P&gt;Am I misunderstanding something here maybe?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our goal would be to have the Query as CREATE OR REFRESH and WITH ROW FILTER running inside of a DLT pipeline.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 15:50:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/row-level-security-while-streaming-data-with-materialized-views/m-p/80411#M36009</guid>
      <dc:creator>Splush</dc:creator>
      <dc:date>2024-07-24T15:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Row Level Security while streaming data with Materialized views</title>
      <link>https://community.databricks.com/t5/data-engineering/row-level-security-while-streaming-data-with-materialized-views/m-p/80444#M36013</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113589"&gt;@Splush&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;There are 2 ways to create materialized views at the current moment:&lt;BR /&gt;&lt;BR /&gt;1. Through Databricks SQL: &lt;A href="https://docs.databricks.com/en/views/materialized.html#use-materialized-views-in-databricks-sql" target="_self"&gt;Use Materialized Views in Databricks SQL&lt;/A&gt;. These are the &lt;A href="https://docs.databricks.com/en/views/materialized.html#limitations" target="_blank"&gt;limitations&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;2. Through DLT:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta-live-tables/index.html#materialized-view" target="_self"&gt;Materialized View (DLT).&lt;/A&gt;&amp;nbsp;All DLT tables are subject to these &lt;A href="https://docs.databricks.com/en/delta-live-tables/index.html#limitations" target="_blank"&gt;limitations&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The reason why the statements fail on &lt;STRONG&gt;interactive&lt;/STRONG&gt; or &lt;STRONG&gt;job&lt;/STRONG&gt; clusters is because materialized view declaration is only supported on DBSQL or DLT, there's no random reason.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now regarding RLS (Row Level Security), these are the docs:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html#filter-sensitive-table-data-using-row-filters-and-column-masks" target="_blank"&gt;Filter sensitive table data using row filters and column masks.&lt;/A&gt;&amp;nbsp;And these are the&amp;nbsp;&lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html#limitations" target="_self"&gt;Limitations&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Regarding your question:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#333333"&gt;Am I misunderstanding something here maybe?&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#333333"&gt;Our goal would be to have the Query as CREATE OR REFRESH and WITH ROW FILTER running inside of a DLT pipeline.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;At the current stage of the preview (2024-07-24), one of the limitations is: &lt;EM&gt;"Materialized views and streaming tables declared in Delta Live Tables don’t support row filters or column masks.".&amp;nbsp;&lt;/EM&gt;I believe this statement should answer your question.&lt;/P&gt;
&lt;P&gt;Databricks is working on improving the DLT compatibility with overall UC features and you can expect to see this limitation being removed on future DLT releases.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 20:18:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/row-level-security-while-streaming-data-with-materialized-views/m-p/80444#M36013</guid>
      <dc:creator>raphaelblg</dc:creator>
      <dc:date>2024-07-24T20:18:07Z</dc:date>
    </item>
  </channel>
</rss>

