<?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: Databricks Python stored procedures in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158180#M54672</link>
    <description>&lt;P&gt;You can use the language &lt;STRONG&gt;SQL&lt;/STRONG&gt; instead of PYTHON as its the supported language for stored procedures.&lt;/P&gt;&lt;P&gt;SQL stored procedures are good for scripting &amp;amp; creating modular SQL based workflows within boundary of Unity Catalog. It's a secure governed way to execute SQL without leaving warehouse.&lt;/P&gt;&lt;P&gt;However, if the workflows need advanced code logic, &lt;STRONG&gt;complex loops&lt;/STRONG&gt; or manipulation of the &lt;STRONG&gt;Spark session&lt;/STRONG&gt;, you can use &lt;STRONG&gt;databricks notebook&lt;/STRONG&gt; running &lt;STRONG&gt;Python spark code&lt;/STRONG&gt; as it gives access to the full power of &lt;STRONG&gt;Spark&lt;/STRONG&gt; helping you create &lt;STRONG&gt;scalable &amp;amp; complex&lt;/STRONG&gt; data pipelines that &lt;STRONG&gt;SQL cannot support&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;More details &lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-procedure#syntax" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2026 05:33:40 GMT</pubDate>
    <dc:creator>balajij8</dc:creator>
    <dc:date>2026-06-03T05:33:40Z</dc:date>
    <item>
      <title>Databricks Python stored procedures</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158178#M54671</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using databricks runtime 17.3.x-scala2.13 ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;But I am unable to create python stored procedures, (functions are possible but they dont support a spark session like below) , any thoughts/help is much appreciated ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;[&lt;SPAN&gt;&lt;A href="https://learn.microsoft.com/azure/databricks/error-messages/error-classes#invalid_statement_or_clause" target="_blank" rel="noopener"&gt;INVALID_STATEMENT_OR_CLAUSE&lt;/A&gt;&lt;/SPAN&gt;]&amp;nbsp;The statement or clause: CREATE PROCEDURE ... LANGUAGE PYTHON is not valid. SQLSTATE: 42601 == SQL (line 2, position 1) == LANGUAGE PYTHON ^^^^^^^^^^^^^^^&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is the code I am trying&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CREATE OR REPLACE PROCEDURE test_cat.rg_test_landing.get_max_table_version(IN&amp;nbsp;table_name STRING, OUT&amp;nbsp;p_max_version BIGINT)&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LANGUAGE&amp;nbsp;&lt;STRONG&gt;PYTHON&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;SQL SECURITY INVOKER&lt;/DIV&gt;&lt;DIV&gt;AS&amp;nbsp;$$&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; df = spark.sql(f"DESCRIBE HISTORY {tbl_name}")&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; target_operations = ["WRITE", "MERGE", "UPDATE", "DELETE"]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; filtered_df = df.filter(df.operation.isin(target_operations))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; if filtered_df.count() &amp;gt; 0:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; max_version = filtered_df.select("version").orderBy("version", ascending=False).first()[0]&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; --print(max_version)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p_max_version = max_version&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; else:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p_max_version = None&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;$$;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I also found the following Youtube video as well&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=f4TxNBfSNqM" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=f4TxNBfSNqM&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks!&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Jun 2026 04:27:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158178#M54671</guid>
      <dc:creator>RGSLCA</dc:creator>
      <dc:date>2026-06-03T04:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Python stored procedures</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158180#M54672</link>
      <description>&lt;P&gt;You can use the language &lt;STRONG&gt;SQL&lt;/STRONG&gt; instead of PYTHON as its the supported language for stored procedures.&lt;/P&gt;&lt;P&gt;SQL stored procedures are good for scripting &amp;amp; creating modular SQL based workflows within boundary of Unity Catalog. It's a secure governed way to execute SQL without leaving warehouse.&lt;/P&gt;&lt;P&gt;However, if the workflows need advanced code logic, &lt;STRONG&gt;complex loops&lt;/STRONG&gt; or manipulation of the &lt;STRONG&gt;Spark session&lt;/STRONG&gt;, you can use &lt;STRONG&gt;databricks notebook&lt;/STRONG&gt; running &lt;STRONG&gt;Python spark code&lt;/STRONG&gt; as it gives access to the full power of &lt;STRONG&gt;Spark&lt;/STRONG&gt; helping you create &lt;STRONG&gt;scalable &amp;amp; complex&lt;/STRONG&gt; data pipelines that &lt;STRONG&gt;SQL cannot support&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;More details &lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-procedure#syntax" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 05:33:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158180#M54672</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-06-03T05:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Python stored procedures</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158188#M54674</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/233222"&gt;@RGSLCA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This video is a bit misleading - look at the comments section. This feature was not released and as of now you can only create stored procedure using an SQL language.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 07:35:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158188#M54674</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-06-03T07:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Python stored procedures</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158194#M54676</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Databricks stored procedures currently support &lt;/SPAN&gt;&lt;SPAN&gt;LANGUAGE SQL&lt;/SPAN&gt;&lt;SPAN&gt;, not &lt;/SPAN&gt;&lt;SPAN&gt;LANGUAGE PYTHON&lt;/SPAN&gt;&lt;SPAN&gt;, so that error is expected. Docs show &lt;/SPAN&gt;&lt;SPAN&gt;CREATE PROCEDURE&lt;/SPAN&gt;&lt;SPAN&gt; supports &lt;/SPAN&gt;&lt;SPAN&gt;LANGUAGE SQL&lt;/SPAN&gt;&lt;SPAN&gt; only, on DBR 17.0+ with Unity Catalog.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2026 08:22:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158194#M54676</guid>
      <dc:creator>naveen0808</dc:creator>
      <dc:date>2026-06-03T08:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks Python stored procedures</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158279#M54691</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;As others have said stored procedures don't currently support Python. You can either create the stored procedure with SQL using Windows functions and describe history or put it into a notebook and not have stored procedures. The video is about experimental features.&lt;/P&gt;
&lt;P&gt;Current docs:&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;CREATE PROCEDURE docs (SQL only):&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-procedure" rel="noopener noreferrer" target="_blank"&gt;https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-procedure&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;SQL scripting for procedural logic:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-scripting" rel="noopener noreferrer" target="_blank"&gt;https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-scripting&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;DESCRIBE HISTORY for Delta table version queries:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-functions" rel="noopener noreferrer" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-functions&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Emma&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 08:02:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-python-stored-procedures/m-p/158279#M54691</guid>
      <dc:creator>emma_s</dc:creator>
      <dc:date>2026-06-04T08:02:02Z</dc:date>
    </item>
  </channel>
</rss>

