<?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 Python UDF to Send Messages to MS Teams in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/117946#M45591</link>
    <description>&lt;P&gt;Good Morning All -&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn't seem like such a daunting task until I tried it. Of course, it's my &lt;EM&gt;very first function in Unity Catalog.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached are images of both the UDF and example usage I created to send messages via the Python requests library within the UDF. I'll see if I can paste in the code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The UDF is supplied with a URL and payload (JSON - Adaptative card for MS Teams). It should send the payload as a Teams message and works as intended when defined internally within a Python notebook. But when defined within UC and executed from a notebook, it sends no message and returns no errors.&lt;BR /&gt;&lt;BR /&gt;I would appreciate it if one of you experts would eyeball this thing and pull me out of the weeds. I can't believe I'm the first one to try this although hours spent researching it has only resulted in references to defining the processing internally within the notebook.&lt;/P&gt;&lt;P&gt;====================&amp;nbsp; UDF ===========================&lt;/P&gt;&lt;P&gt;CREATE OR REPLACE FUNCTION mycatalog.myschema.udf_send_post_request(&lt;BR /&gt;url STRING,&lt;BR /&gt;payload STRING&lt;BR /&gt;)&lt;BR /&gt;RETURNS STRING&lt;BR /&gt;LANGUAGE PYTHON&lt;BR /&gt;AS&lt;BR /&gt;$$&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;/P&gt;&lt;P&gt;def udf_send_post_request(url, payload):&lt;BR /&gt;try:&lt;BR /&gt;# Convert payload from string to JSON&lt;BR /&gt;payload_json = json.loads(payload)&lt;BR /&gt;response = requests.post(url, json=payload_json)&lt;BR /&gt;response.raise_for_status() # Raise an error for bad status codes&lt;BR /&gt;return response.text&lt;BR /&gt;except requests.exceptions.RequestException as e:&lt;BR /&gt;return f"Error: {e}"&lt;/P&gt;&lt;P&gt;$$;&lt;/P&gt;&lt;P&gt;====================&amp;nbsp; USAGE ===========================&lt;/P&gt;&lt;P&gt;# Set the catalog and schema&lt;BR /&gt;spark.sql("USE CATALOG mycatalog")&lt;BR /&gt;spark.sql("USE SCHEMA myschema")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Example usage&lt;BR /&gt;url = "myURL"&lt;/P&gt;&lt;P&gt;payload = {&lt;BR /&gt;"type": "AdaptiveCard",&lt;BR /&gt;"attachments": [&lt;BR /&gt;{&lt;BR /&gt;"contentType": "application/vnd.microsoft.card.adaptive",&lt;BR /&gt;"content": {&lt;BR /&gt;"$schema": "&lt;A href="http://adaptivecards.io/schemas/adaptive-card.json" target="_blank" rel="noopener"&gt;http://adaptivecards.io/schemas/adaptive-card.json&lt;/A&gt;",&lt;BR /&gt;"type": "AdaptiveCard",&lt;BR /&gt;"version": "1.2",&lt;BR /&gt;"body": [&lt;BR /&gt;{&lt;BR /&gt;"type": "TextBlock",&lt;BR /&gt;"text": "**TEST EXTERNAL FUNCTION**",&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;payload_str = json.dumps(payload)&lt;/P&gt;&lt;P&gt;# Create a DataFrame with the URL and payload&lt;BR /&gt;df = spark.createDataFrame([(url, payload_str)], ["url", "payload"])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Use the function in a SQL query&lt;BR /&gt;df.createOrReplaceTempView("temp_table")&lt;BR /&gt;result = spark.sql(f"""SELECT udf_send_post_request(url, payload) AS response FROM temp_table""")&lt;BR /&gt;result.show()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You for Any &amp;amp; All Input,&lt;/P&gt;&lt;P&gt;Bob&lt;/P&gt;</description>
    <pubDate>Tue, 06 May 2025 16:17:47 GMT</pubDate>
    <dc:creator>SQLBob</dc:creator>
    <dc:date>2025-05-06T16:17:47Z</dc:date>
    <item>
      <title>Unity Catalog Python UDF to Send Messages to MS Teams</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/117946#M45591</link>
      <description>&lt;P&gt;Good Morning All -&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn't seem like such a daunting task until I tried it. Of course, it's my &lt;EM&gt;very first function in Unity Catalog.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached are images of both the UDF and example usage I created to send messages via the Python requests library within the UDF. I'll see if I can paste in the code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The UDF is supplied with a URL and payload (JSON - Adaptative card for MS Teams). It should send the payload as a Teams message and works as intended when defined internally within a Python notebook. But when defined within UC and executed from a notebook, it sends no message and returns no errors.&lt;BR /&gt;&lt;BR /&gt;I would appreciate it if one of you experts would eyeball this thing and pull me out of the weeds. I can't believe I'm the first one to try this although hours spent researching it has only resulted in references to defining the processing internally within the notebook.&lt;/P&gt;&lt;P&gt;====================&amp;nbsp; UDF ===========================&lt;/P&gt;&lt;P&gt;CREATE OR REPLACE FUNCTION mycatalog.myschema.udf_send_post_request(&lt;BR /&gt;url STRING,&lt;BR /&gt;payload STRING&lt;BR /&gt;)&lt;BR /&gt;RETURNS STRING&lt;BR /&gt;LANGUAGE PYTHON&lt;BR /&gt;AS&lt;BR /&gt;$$&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import json&lt;/P&gt;&lt;P&gt;def udf_send_post_request(url, payload):&lt;BR /&gt;try:&lt;BR /&gt;# Convert payload from string to JSON&lt;BR /&gt;payload_json = json.loads(payload)&lt;BR /&gt;response = requests.post(url, json=payload_json)&lt;BR /&gt;response.raise_for_status() # Raise an error for bad status codes&lt;BR /&gt;return response.text&lt;BR /&gt;except requests.exceptions.RequestException as e:&lt;BR /&gt;return f"Error: {e}"&lt;/P&gt;&lt;P&gt;$$;&lt;/P&gt;&lt;P&gt;====================&amp;nbsp; USAGE ===========================&lt;/P&gt;&lt;P&gt;# Set the catalog and schema&lt;BR /&gt;spark.sql("USE CATALOG mycatalog")&lt;BR /&gt;spark.sql("USE SCHEMA myschema")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Example usage&lt;BR /&gt;url = "myURL"&lt;/P&gt;&lt;P&gt;payload = {&lt;BR /&gt;"type": "AdaptiveCard",&lt;BR /&gt;"attachments": [&lt;BR /&gt;{&lt;BR /&gt;"contentType": "application/vnd.microsoft.card.adaptive",&lt;BR /&gt;"content": {&lt;BR /&gt;"$schema": "&lt;A href="http://adaptivecards.io/schemas/adaptive-card.json" target="_blank" rel="noopener"&gt;http://adaptivecards.io/schemas/adaptive-card.json&lt;/A&gt;",&lt;BR /&gt;"type": "AdaptiveCard",&lt;BR /&gt;"version": "1.2",&lt;BR /&gt;"body": [&lt;BR /&gt;{&lt;BR /&gt;"type": "TextBlock",&lt;BR /&gt;"text": "**TEST EXTERNAL FUNCTION**",&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;payload_str = json.dumps(payload)&lt;/P&gt;&lt;P&gt;# Create a DataFrame with the URL and payload&lt;BR /&gt;df = spark.createDataFrame([(url, payload_str)], ["url", "payload"])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Use the function in a SQL query&lt;BR /&gt;df.createOrReplaceTempView("temp_table")&lt;BR /&gt;result = spark.sql(f"""SELECT udf_send_post_request(url, payload) AS response FROM temp_table""")&lt;BR /&gt;result.show()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You for Any &amp;amp; All Input,&lt;/P&gt;&lt;P&gt;Bob&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 16:17:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/117946#M45591</guid>
      <dc:creator>SQLBob</dc:creator>
      <dc:date>2025-05-06T16:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Python UDF to Send Messages to MS Teams</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/118292#M45624</link>
      <description>&lt;P&gt;This has been dropped in favor of using a function defined internally within a notebook. If anyone has occasion to get a similar process set up - please let me know.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 17:53:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/118292#M45624</guid>
      <dc:creator>SQLBob</dc:creator>
      <dc:date>2025-05-07T17:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Unity Catalog Python UDF to Send Messages to MS Teams</title>
      <link>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/138485#M50937</link>
      <description>&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;You're encountering a common limitation when trying to use an&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;external HTTP request (like the Python requests library)&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;inside a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Unity Catalog UDF&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in Databricks. While your code is correct for a regular notebook environment, Unity Catalog UDFs (and, similarly, Spark SQL UDFs running in distributed compute)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;run in a restricted, sandboxed environment&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;where&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;outbound HTTP calls&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are not allowed for security reasons.&lt;/P&gt;
&lt;H2 id="why-it-works-in-notebook-but-not-in-udf" class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0 md:text-lg [hr+&amp;amp;]:mt-4"&gt;Why It Works in Notebook But Not in UDF&lt;/H2&gt;
&lt;UL class="marker:text-quiet list-disc"&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;STRONG&gt;Notebooks:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Full access to Python environment, packages, and outbound internet.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;STRONG&gt;Unity Catalog Functions:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Sandboxed, limited. No network access, no additional installs, can only use a subset of Python's standard library.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;This is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;by design&lt;/STRONG&gt;, because otherwise user-defined SQL functions could be used to exfiltrate data or trigger security vulnerabilities.&lt;/P&gt;
&lt;HR /&gt;
&lt;H2 id="what-are-your-options" class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0 md:text-lg [hr+&amp;amp;]:mt-4"&gt;What Are Your Options?&lt;/H2&gt;
&lt;H2 class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0"&gt;Use Notebook Code for HTTP Calls&lt;/H2&gt;
&lt;UL class="marker:text-quiet list-disc"&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Perform the HTTP call from your notebook code (or Python UDF).&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;If the workflow requires SQL,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;submit results into a table&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and consume from there.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;H2 class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0"&gt;Use External Functions (Databricks Feature)&lt;/H2&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;STRONG&gt;Databricks External Functions&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;allow you to call external HTTP endpoints&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;securely&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;from SQL. These are designed for invoking webhooks or external APIs from SQL, similar to what you're after, and are most often integrated with Unity Catalog.&lt;/P&gt;
&lt;UL class="marker:text-quiet list-disc"&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;&lt;A class="reset interactable cursor-pointer decoration-1 underline-offset-1 text-super hover:underline font-semibold" href="https://docs.databricks.com/en/sql/language-manual/external-functions.html" target="_blank" rel="nofollow noopener"&gt;&lt;SPAN class="text-box-trim-both"&gt;Official Databricks documentation on external functions&lt;/SPAN&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Basic example:&lt;/P&gt;
&lt;DIV class="w-full md:max-w-[90vw]"&gt;
&lt;DIV class="codeWrapper text-light selection:text-super selection:bg-super/10 my-md relative flex flex-col rounded font-mono text-sm font-normal bg-subtler"&gt;
&lt;DIV class="translate-y-xs -translate-x-xs bottom-xl mb-xl flex h-0 items-start justify-end md:sticky md:top-[100px]"&gt;
&lt;DIV class="overflow-hidden rounded-full border-subtlest ring-subtlest divide-subtlest bg-base"&gt;
&lt;DIV class="border-subtlest ring-subtlest divide-subtlest bg-subtler"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="-mt-xl"&gt;
&lt;DIV&gt;
&lt;DIV class="text-quiet bg-subtle py-xs px-sm inline-block rounded-br rounded-tl-[3px] font-thin" data-testid="code-language-indicator"&gt;sql&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;CODE&gt;&lt;SPAN class="token token"&gt;CREATE&lt;/SPAN&gt; EXTERNAL &lt;SPAN class="token token"&gt;FUNCTION&lt;/SPAN&gt; send_teams_message&lt;SPAN class="token token punctuation"&gt;(&lt;/SPAN&gt;url STRING&lt;SPAN class="token token punctuation"&gt;,&lt;/SPAN&gt; payload STRING&lt;SPAN class="token token punctuation"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token token"&gt;RETURNS&lt;/SPAN&gt; STRING
&lt;SPAN class="token token"&gt;USING&lt;/SPAN&gt; REQUEST_URL &lt;SPAN class="token token"&gt;'&amp;lt;your-azure-function-or-api-endpoint&amp;gt;'&lt;/SPAN&gt;&lt;SPAN class="token token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;You need a secure HTTP endpoint (Azure Function, AWS Lambda, REST API you manage) to receive requests from Databricks.&lt;/P&gt;
&lt;H2 class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0"&gt;Why "No Errors"?&lt;/H2&gt;
&lt;UL class="marker:text-quiet list-disc"&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Unity Catalog UDFs may fail silently for forbidden or unimplemented features.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;If outbound HTTP is restricted,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;requests.post()&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;simply does not run, and you may get&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;None&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or an empty response, with no error bubbling to the surface.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;HR /&gt;
&lt;H2 id="summary-table" class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0 md:text-lg [hr+&amp;amp;]:mt-4"&gt;Summary Table&lt;/H2&gt;
&lt;DIV class="group relative"&gt;
&lt;DIV class="w-full overflow-x-auto md:max-w-[90vw] border-subtlest ring-subtlest divide-subtlest bg-transparent"&gt;
&lt;TABLE class="border-subtler my-[1em] w-full table-auto border-separate border-spacing-0 border-l border-t"&gt;
&lt;THEAD class="bg-subtler"&gt;
&lt;TR&gt;
&lt;TH class="border-subtler p-sm break-normal border-b border-r text-left align-top"&gt;Environment&lt;/TH&gt;
&lt;TH class="border-subtler p-sm break-normal border-b border-r text-left align-top"&gt;Can Do HTTP Requests?&lt;/TH&gt;
&lt;TH class="border-subtler p-sm break-normal border-b border-r text-left align-top"&gt;Example Approach&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Notebook Python&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Yes&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;requests&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or similar&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Python UDF&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;No (in UC/SparkSQL)&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Not supported&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Unity Catalog UDF&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;No&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Not supported&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;External Function&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Yes&lt;/TD&gt;
&lt;TD class="px-sm border-subtler min-w-[48px] break-normal border-b border-r"&gt;Use Databricks External Function&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;DIV class="bg-base border-subtler shadow-subtle pointer-coarse:opacity-100 right-xs absolute bottom-0 flex rounded-lg border opacity-0 transition-opacity group-hover:opacity-100 [&amp;amp;&amp;gt;*:not(:first-child)]:border-subtle [&amp;amp;&amp;gt;*:not(:first-child)]:border-l"&gt;
&lt;DIV class="flex"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="flex"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;
&lt;H2 id="what-to-do-next" class="mb-2 mt-4 font-display font-semimedium text-base first:mt-0 md:text-lg [hr+&amp;amp;]:mt-4"&gt;What To Do Next&lt;/H2&gt;
&lt;UL class="marker:text-quiet list-disc"&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Refactor: Move the message send logic out of the UC UDF.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;Use Databricks External Functions if you need SQL access to HTTP APIs.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI class="py-0 my-0 prose-p:pt-0 prose-p:mb-2 prose-p:my-0 [&amp;amp;&amp;gt;p]:pt-0 [&amp;amp;&amp;gt;p]:mb-2 [&amp;amp;&amp;gt;p]:my-0"&gt;
&lt;P class="my-2 [&amp;amp;+p]:mt-4 [&amp;amp;_strong:has(+br)]:inline-block [&amp;amp;_strong:has(+br)]:pb-2"&gt;If working in notebooks, use Python code directly where possible.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 11 Nov 2025 01:27:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unity-catalog-python-udf-to-send-messages-to-ms-teams/m-p/138485#M50937</guid>
      <dc:creator>mark_ott</dc:creator>
      <dc:date>2025-11-11T01:27:12Z</dc:date>
    </item>
  </channel>
</rss>

