<?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: Row Filter on Unity Catalog Tables based on Unity Catalog group appartenance in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81480#M36320</link>
    <description>&lt;P&gt;Ok, so this problem needs no tricks. All was in &lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html#row-filter-examples" target="_self"&gt;the documentation&lt;/A&gt;&lt;BR /&gt;I did not know about the function &lt;SPAN&gt;IS_ACCOUNT_GROUP_MEMBER().&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;So this Row Filter function did the job:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;CREATE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt;&lt;SPAN&gt; rd.my_schema.my_row_filter(filter_column&amp;nbsp;INTEGER)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;RETURNS&lt;/SPAN&gt; &lt;SPAN&gt;BOOLEAN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;IF(IS_ACCOUNT_GROUP_MEMBER(&lt;/SPAN&gt;&lt;SPAN&gt;'restricted_users_group'&lt;/SPAN&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;filter_column &lt;/SPAN&gt;&lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;15&lt;/SPAN&gt;&lt;SPAN&gt;, 16, 17&lt;/SPAN&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 12:15:44 GMT</pubDate>
    <dc:creator>Antoine_B</dc:creator>
    <dc:date>2024-08-01T12:15:44Z</dc:date>
    <item>
      <title>Row Filter on Unity Catalog Tables based on Unity Catalog group appartenance</title>
      <link>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81324#M36269</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to prevent users belonging to a given Unity Catalog group ('restricted_users_group') to access some rows of a Unity Catalog Table.&lt;BR /&gt;&lt;BR /&gt;For now, I was able to define a Row Filter function to prevent a list of users to access some rows, thanks to &lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html" target="_self"&gt;this documentation&lt;/A&gt;.&lt;BR /&gt;Here is my current function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;-- apply Row Filter only for user &lt;A href="mailto:restricted@users.com" target="_blank"&gt;restricted@users.com&lt;/A&gt;. Filter is disabled for other users&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;CREATE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt;&lt;SPAN&gt; rd.my_schema.&lt;/SPAN&gt;&lt;SPAN&gt;my_row_filter(&lt;/SPAN&gt;&lt;SPAN&gt;filter_column&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;INTEGER&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;RETURNS&lt;/SPAN&gt; &lt;SPAN&gt;BOOLEAN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;IF(CURRENT_USER(&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;'&lt;A href="mailto:restricted@users.com" target="_blank"&gt;restricted@users.com&lt;/A&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;, filter_column &lt;/SPAN&gt;&lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;15, 16, 17&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here is how I apply this Row Filter function to two of my sensitive tables:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;ALTER&lt;/SPAN&gt; &lt;SPAN&gt;TABLE&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;rd.my_schema.my_table_1&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;SET&lt;/SPAN&gt; &lt;SPAN&gt;ROW&lt;/SPAN&gt; &lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; rd.my_schema.my_row_filter &lt;/SPAN&gt;&lt;SPAN&gt;ON&lt;/SPAN&gt;&lt;SPAN&gt; (id_col);&lt;BR /&gt;ALTER TABLE&amp;nbsp;rd.my_schema.my_table_2 SET ROW FILTER rd.my_schema.my_row_filter ON (id_col);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;But I would like some help to adapt this function to work with Unity Catalog groups instead of users.&lt;BR /&gt;Because I would like to avoid editing my Row Filter function each time a new user is added to this group ('restricted_users_group').&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 Jul 2024 13:12:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81324#M36269</guid>
      <dc:creator>Antoine_B</dc:creator>
      <dc:date>2024-07-31T13:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Row Filter on Unity Catalog Tables based on Unity Catalog group appartenance</title>
      <link>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81338#M36273</link>
      <description>&lt;P&gt;I saw the tricks of mapping tables:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html#mapping-table-examples" target="_blank"&gt;https://docs.databricks.com/en/tables/row-and-column-filters.html#mapping-table-examples&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This means I have to create a Job to keep my mapping table up to date with users in the Unity Catalog group.&lt;BR /&gt;I keep this solution in mind, but I wonder if something more integrated in Row Filters functions exists, without the need of a mapping table ?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 14:23:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81338#M36273</guid>
      <dc:creator>Antoine_B</dc:creator>
      <dc:date>2024-07-31T14:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Row Filter on Unity Catalog Tables based on Unity Catalog group appartenance</title>
      <link>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81480#M36320</link>
      <description>&lt;P&gt;Ok, so this problem needs no tricks. All was in &lt;A href="https://docs.databricks.com/en/tables/row-and-column-filters.html#row-filter-examples" target="_self"&gt;the documentation&lt;/A&gt;&lt;BR /&gt;I did not know about the function &lt;SPAN&gt;IS_ACCOUNT_GROUP_MEMBER().&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;So this Row Filter function did the job:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;CREATE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt;&lt;SPAN&gt; rd.my_schema.my_row_filter(filter_column&amp;nbsp;INTEGER)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;RETURNS&lt;/SPAN&gt; &lt;SPAN&gt;BOOLEAN&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;IF(IS_ACCOUNT_GROUP_MEMBER(&lt;/SPAN&gt;&lt;SPAN&gt;'restricted_users_group'&lt;/SPAN&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;filter_column &lt;/SPAN&gt;&lt;SPAN&gt;IN&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;15&lt;/SPAN&gt;&lt;SPAN&gt;, 16, 17&lt;/SPAN&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 12:15:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/row-filter-on-unity-catalog-tables-based-on-unity-catalog-group/m-p/81480#M36320</guid>
      <dc:creator>Antoine_B</dc:creator>
      <dc:date>2024-08-01T12:15:44Z</dc:date>
    </item>
  </channel>
</rss>

