<?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: SQL UDFs for DLT pipelines in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/2929#M162</link>
    <description>&lt;P&gt;Hi @Joshua Abiodun-Olojede​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Jun 2023 09:31:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-17T09:31:57Z</dc:date>
    <item>
      <title>SQL UDFs for DLT pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/2928#M161</link>
      <description>&lt;P&gt;I am trying to implement a UDF for a DLT pipeline. I have seen the documentation stating that it is possible but I am getting an error after adding an SQL UDF to a cell in the notebook attached to the pipeline. The aim is to have the UDF in a separate notebook on its own but both failed with the same error (see attached image below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the UDF:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE FUNCTION IF NOT EXISTS gtin_std(number STRING)&lt;/P&gt;&lt;P&gt;RETURNS STRING&lt;/P&gt;&lt;P&gt;BEGIN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;DECLARE gtin VARCHAR(20);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;DECLARE gtin_std VARCHAR(20);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;SET gtin = REGEXP_REPLACE(number, '[^0-9]', '');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;IF LENGTH(gtin) IN (8, 12, 13, 14) THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET gtin_std = LPAD(TRIM(gtin), 14, '0');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RETURN gtin_std;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;ELSE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RETURN NULL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;END IF;&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 23:33:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/2928#M161</guid>
      <dc:creator>famous_jt33</dc:creator>
      <dc:date>2023-06-16T23:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UDFs for DLT pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/2929#M162</link>
      <description>&lt;P&gt;Hi @Joshua Abiodun-Olojede​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 09:31:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/2929#M162</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-17T09:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: SQL UDFs for DLT pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/55515#M30357</link>
      <description>&lt;P&gt;You can't.&amp;nbsp;&lt;BR /&gt;The SQL support on DLT pipeline cluster is limited compared to a normal notebook. You can still define a UDF in Python using, of course, a Python notebook. In this case, you can use the spark.sql() function to execute your original SQL code, which is supposed to be a subset of the original one.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 17:52:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-udfs-for-dlt-pipelines/m-p/55515#M30357</guid>
      <dc:creator>6502</dc:creator>
      <dc:date>2023-12-19T17:52:13Z</dc:date>
    </item>
  </channel>
</rss>

