<?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 Best way to run a job/trigger on alter table SET ROW FILTER or SET MASK in Data Governance</title>
    <link>https://community.databricks.com/t5/data-governance/best-way-to-run-a-job-trigger-on-alter-table-set-row-filter-or/m-p/57262#M1541</link>
    <description>&lt;P&gt;I want to run SQL statements whenever we add&amp;nbsp;ROW FILTER or MASK using ALTER TABLE command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html#alter-column" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html#alter-column&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am new to databricks and I am trying to do it through a trigger job which can be created already and run automatically on the ALTER TABLE but I could not find a way to set a trigger on the alter table.&lt;/P&gt;&lt;P&gt;Can someone please help me what could be the best way to do this in databricks?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Jan 2024 00:02:53 GMT</pubDate>
    <dc:creator>ravi_kumar</dc:creator>
    <dc:date>2024-01-14T00:02:53Z</dc:date>
    <item>
      <title>Best way to run a job/trigger on alter table SET ROW FILTER or SET MASK</title>
      <link>https://community.databricks.com/t5/data-governance/best-way-to-run-a-job-trigger-on-alter-table-set-row-filter-or/m-p/57262#M1541</link>
      <description>&lt;P&gt;I want to run SQL statements whenever we add&amp;nbsp;ROW FILTER or MASK using ALTER TABLE command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html#alter-column" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-alter-table-manage-column.html#alter-column&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am new to databricks and I am trying to do it through a trigger job which can be created already and run automatically on the ALTER TABLE but I could not find a way to set a trigger on the alter table.&lt;/P&gt;&lt;P&gt;Can someone please help me what could be the best way to do this in databricks?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 00:02:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/best-way-to-run-a-job-trigger-on-alter-table-set-row-filter-or/m-p/57262#M1541</guid>
      <dc:creator>ravi_kumar</dc:creator>
      <dc:date>2024-01-14T00:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to run a job/trigger on alter table SET ROW FILTER or SET MASK</title>
      <link>https://community.databricks.com/t5/data-governance/best-way-to-run-a-job-trigger-on-alter-table-set-row-filter-or/m-p/57963#M1566</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The best way to run a jobon&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="c-mrkdwn__code" data-stringify-type="code"&gt;ALTER TABLE SET ROW FILTER&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="c-mrkdwn__code" data-stringify-type="code"&gt;SET MASK&lt;/CODE&gt;&lt;SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;1. **Create the Function**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;&amp;nbsp;You need to start by creating a function that will be used to filter the rows or mask the columns. The function should return a boolean value that determines whether a row or column should be included or excluded.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;sql&lt;BR /&gt;CREATE FUNCTION &amp;lt;function_name&amp;gt; (&amp;lt;parameter_name&amp;gt; &amp;lt;parameter_type&amp;gt;, ..) RETURN {filter clause whose output must be a boolean};&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;2. **Apply the Row Filter or Mask to a Table**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;&amp;nbsp;After creating the function, you apply it to a table using the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="c-mrkdwn__code" data-stringify-type="code"&gt;ALTER TABLE&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;sql&lt;BR /&gt;ALTER TABLE &amp;lt;table_name&amp;gt; SET ROW FILTER &amp;lt;function_name&amp;gt; ON (&amp;lt;column_name&amp;gt;, ..);&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;sql&lt;BR /&gt;ALTER TABLE &amp;lt;table_name&amp;gt; SET MASK &amp;lt;function_name&amp;gt; ON (&amp;lt;column_name&amp;gt;, ..);&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;3. **Run the Job/Trigger**&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;&amp;nbsp;Now that the filter or mask is set, you can run your job or trigger. Any queries that are run on the table will now be subject to the filter or mask that you have applied.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Please note that row filters or column masks should not be added to any table that you are accessing from single user clusters. This is commonly done in the context of Databricks Jobs.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 18:00:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/best-way-to-run-a-job-trigger-on-alter-table-set-row-filter-or/m-p/57963#M1566</guid>
      <dc:creator>Walter_C</dc:creator>
      <dc:date>2024-01-20T18:00:13Z</dc:date>
    </item>
  </channel>
</rss>

