<?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 Unity Catalog functions in Data Governance</title>
    <link>https://community.databricks.com/t5/data-governance/unity-catalog-functions/m-p/138041#M2665</link>
    <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recent days I created a SQL function into my unity catalog for my trusted assets in my genie space, I gave permission to my users accounts for they saw these function, however yesterday I modified my functions using the command "&lt;SPAN&gt;CREATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt; &lt;SPAN&gt;REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt;&lt;SPAN&gt;" and today a coworker said me what he needs permission again :S&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I update my function without deleting its permissions?&amp;nbsp;&lt;/SPAN&gt;Someone can help me?&lt;/P&gt;</description>
    <pubDate>Thu, 06 Nov 2025 21:12:40 GMT</pubDate>
    <dc:creator>Dulce42</dc:creator>
    <dc:date>2025-11-06T21:12:40Z</dc:date>
    <item>
      <title>Unity Catalog functions</title>
      <link>https://community.databricks.com/t5/data-governance/unity-catalog-functions/m-p/138041#M2665</link>
      <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recent days I created a SQL function into my unity catalog for my trusted assets in my genie space, I gave permission to my users accounts for they saw these function, however yesterday I modified my functions using the command "&lt;SPAN&gt;CREATE&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt; &lt;SPAN&gt;REPLACE&lt;/SPAN&gt; &lt;SPAN&gt;FUNCTION&lt;/SPAN&gt;&lt;SPAN&gt;" and today a coworker said me what he needs permission again :S&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I update my function without deleting its permissions?&amp;nbsp;&lt;/SPAN&gt;Someone can help me?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2025 21:12:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/unity-catalog-functions/m-p/138041#M2665</guid>
      <dc:creator>Dulce42</dc:creator>
      <dc:date>2025-11-06T21:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog functions</title>
      <link>https://community.databricks.com/t5/data-governance/unity-catalog-functions/m-p/138047#M2666</link>
      <description>&lt;P&gt;Greetings&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146507"&gt;@Dulce42&lt;/a&gt;&amp;nbsp;,&amp;nbsp; this is a known gotcha with Unity Catalog functions: updating a function with CREATE OR REPLACE FUNCTION currently replaces the object and drops its grants, so downstream users lose EXECUTE permission and need to be re-granted. This behavior is tracked internally and differs from tables, where CREATE OR REPLACE preserves privileges.&lt;/P&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H3 class="paragraph"&gt;Why this happened&lt;/H3&gt;
&lt;UL&gt;
&lt;LI class="paragraph"&gt;&lt;STRONG&gt;CREATE OR REPLACE FUNCTION&lt;/STRONG&gt; replaces the function object (keeping the name/signature but recreating the object), which resets grants on that function. This is a documented product issue under UC-5574.&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;In contrast, &lt;STRONG&gt;CREATE OR REPLACE TABLE&lt;/STRONG&gt; explicitly preserves history and granted privileges, row filters, and column masks, which is why you don’t see this problem with tables.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;To call a &lt;STRONG&gt;Unity Catalog UDF&lt;/STRONG&gt;, users need three permissions: &lt;STRONG&gt;EXECUTE&lt;/STRONG&gt; on the function and &lt;STRONG&gt;USE CATALOG&lt;/STRONG&gt; and &lt;STRONG&gt;USE SCHEMA&lt;/STRONG&gt; on its parent catalog and schema.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;H3 class="paragraph"&gt;The durable fix (avoid losing permissions on updates)&lt;/H3&gt;
&lt;DIV class="paragraph"&gt;Grant at the container level instead of per-function. Unity Catalog supports privilege inheritance, so granting &lt;STRONG&gt;EXECUTE&lt;/STRONG&gt; at the schema or catalog level applies to all current and future functions in that scope—including after you replace a function.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Example pattern for your “genie” space: &lt;STRONG&gt;Grant baseline access to the container:&lt;/STRONG&gt;&amp;nbsp;GRANT USE CATALOG ON CATALOG genie_catalog TO &lt;CODE&gt;group-or-user&lt;/CODE&gt;.&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;GRANT USE SCHEMA ON SCHEMA genie_catalog.trusted_assets TO &lt;CODE&gt;group-or-user&lt;/CODE&gt;.&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;Grant function-run access that survives replacements:&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;GRANT EXECUTE ON SCHEMA genie_catalog.trusted_assets TO &lt;CODE&gt;group-or-user&lt;/CODE&gt;.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="paragraph"&gt;This way, any CREATE OR REPLACE FUNCTION you do inside that schema won’t require re-granting per function—the EXECUTE privilege is inherited for both existing and newly replaced functions.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H3 class="paragraph"&gt;If you must keep per-function grants&lt;/H3&gt;
&lt;DIV class="paragraph"&gt;If policy requires per-function grants (not schema-level), then reapply grants after each replace. A simple operational pattern is: * Replace the function body without changing its signature (required by the syntax).&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;Immediately re-grant EXECUTE on the function:
&lt;UL&gt;
&lt;LI&gt;GRANT EXECUTE ON FUNCTION genie_catalog.trusted_assets.my_function TO &lt;CODE&gt;group-or-user&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="paragraph"&gt;You can automate this by keeping the list of principals to grant and running the GRANT statements right after each deploy.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H3 class="paragraph"&gt;Example SQL snippets&lt;/H3&gt;
&lt;DIV class="paragraph"&gt;Replace a function (signature unchanged) and rely on schema-level inheritance: &lt;CODE&gt;``sql
-- Ensure callers have container access
GRANT USE CATALOG ON CATALOG genie_catalog TO &lt;/CODE&gt;team-group&lt;CODE&gt;; 
GRANT USE SCHEMA ON SCHEMA genie_catalog.trusted_assets TO &lt;/CODE&gt;team-group`;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;-- Ensure callers inherit EXECUTE on all functions in the schema GRANT EXECUTE ON SCHEMA genie_catalog.trusted_assets TO &lt;CODE&gt;team-group&lt;/CODE&gt;;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;-- Now safely update your function without worrying about per-function grants CREATE OR REPLACE FUNCTION genie_catalog.trusted_assets.calc_metric(x DOUBLE) RETURNS DOUBLE LANGUAGE SQL RETURN x * x; ```&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;If you stick to per-function grants: ```sql CREATE OR REPLACE FUNCTION genie_catalog.trusted_assets.calc_metric(x DOUBLE) RETURNS DOUBLE LANGUAGE SQL RETURN x * x;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;GRANT EXECUTE ON FUNCTION genie_catalog.trusted_assets.calc_metric TO &lt;CODE&gt;user@example.com&lt;/CODE&gt;; ```&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H3 class="paragraph"&gt;Notes and checks&lt;/H3&gt;
&lt;UL&gt;
&lt;LI class="paragraph"&gt;You cannot change the function’s parameter list or types when using OR REPLACE; only the body and return type can be updated if the signature stays the same.&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;If your coworker still can’t call the function even after EXECUTE, double-check they also have &lt;STRONG&gt;USE CATALOG&lt;/STRONG&gt; and &lt;STRONG&gt;USE SCHEMA&lt;/STRONG&gt; on the parent container.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class="paragraph"&gt;This “grants drop on replace” problem is acknowledged for functions today; schema-level EXECUTE inheritance is the recommended mitigation until the product behavior changes.&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Hope this makes things easier.&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Cheers, Louis.&lt;/DIV&gt;</description>
      <pubDate>Thu, 06 Nov 2025 23:06:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-governance/unity-catalog-functions/m-p/138047#M2666</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2025-11-06T23:06:31Z</dc:date>
    </item>
  </channel>
</rss>

