<?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 SQL Stored Procedures - Notebook to always run the CREATE query in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136253#M50529</link>
    <description>&lt;P&gt;I have a stored procedure that is saved as a query file. I can run it and the proc is created. However I want to take this one step further. I want my notebook to run the query file called sp_Remit.sql so if there is any changes to the proc between the runs the Proc will update in gold schema first and then once its updated I can CALL the Proc. I don't want to have to manually create / replace the proc each time via a deployment but instead have the notebook run the query. I was not able to get this to work but I found a work around but don't want to use. I change from a query to a file and executed the file but this removed my ability to run segments of code in the file like I can in a query.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Oct 2025 19:17:23 GMT</pubDate>
    <dc:creator>DM0341</dc:creator>
    <dc:date>2025-10-27T19:17:23Z</dc:date>
    <item>
      <title>SQL Stored Procedures - Notebook to always run the CREATE query</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136253#M50529</link>
      <description>&lt;P&gt;I have a stored procedure that is saved as a query file. I can run it and the proc is created. However I want to take this one step further. I want my notebook to run the query file called sp_Remit.sql so if there is any changes to the proc between the runs the Proc will update in gold schema first and then once its updated I can CALL the Proc. I don't want to have to manually create / replace the proc each time via a deployment but instead have the notebook run the query. I was not able to get this to work but I found a work around but don't want to use. I change from a query to a file and executed the file but this removed my ability to run segments of code in the file like I can in a query.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 19:17:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136253#M50529</guid>
      <dc:creator>DM0341</dc:creator>
      <dc:date>2025-10-27T19:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Stored Procedures - Notebook to always run the CREATE query</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136277#M50534</link>
      <description>&lt;P&gt;Something like this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os

query_name = "test_query.sql"
query_path = os.path.abspath(query_name)

# Read query contents
with open(query_path, "r") as f:
    query_str = f.read()

# Run it
spark.sql(query_str)&lt;/LI-CODE&gt;&lt;P&gt;You can read the script from the sql file and assuming the file is in the same directory as the notebook you are running.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 21:56:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136277#M50534</guid>
      <dc:creator>mynameiskevin</dc:creator>
      <dc:date>2025-10-27T21:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Stored Procedures - Notebook to always run the CREATE query</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136402#M50558</link>
      <description>&lt;P&gt;Thank you. I did find this about an hour after I posted. Thank you Kevin&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 13:23:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-stored-procedures-notebook-to-always-run-the-create-query/m-p/136402#M50558</guid>
      <dc:creator>DM0341</dc:creator>
      <dc:date>2025-10-28T13:23:06Z</dc:date>
    </item>
  </channel>
</rss>

