<?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: code unit 1 line 1 statement, stored as Query - considered &amp;quot;empty&amp;quot; in Job TaskRun - fa in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/150178#M53289</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/211345"&gt;@ADBricksExplore&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;This behavior where a CALL statement works from a Notebook or SQL File task but fails with an "empty" error from a SQL Query task comes down to how these task types resolve the SQL content at runtime.&lt;/P&gt;
&lt;P&gt;UNDERSTANDING THE DIFFERENCE BETWEEN SQL TASK TYPES&lt;/P&gt;
&lt;P&gt;When you configure a job task as SQL &amp;gt; Query, the task references a saved query asset stored in the Databricks SQL workspace (visible under SQL &amp;gt; Queries). At runtime, the job fetches the body of that saved query object and sends it to the SQL warehouse for execution.&lt;/P&gt;
&lt;P&gt;When you use SQL &amp;gt; File, the task reads the .sql file directly from your workspace or Git repo. And when you use a Notebook task, it executes the notebook cell contents directly. Both of these read the content from the file system rather than from the saved query store.&lt;/P&gt;
&lt;P&gt;WHY THE "EMPTY" ERROR OCCURS&lt;/P&gt;
&lt;P&gt;There are a few common reasons the SQL Query task sees an "empty" body even though you can see content in the editor:&lt;/P&gt;
&lt;P&gt;1. The query was not explicitly saved. If you typed or pasted your CALL statement into the SQL editor but never clicked the Save button (or if Save silently failed), the query object in the backend may have an empty body. The editor can show unsaved content in your browser session, but the job fetches the persisted version. Open the query in SQL &amp;gt; Queries &amp;gt; My Queries, verify your CALL statement appears, and click Save explicitly.&lt;/P&gt;
&lt;P&gt;2. The "Run As" user lacks permission to read the query. When a job runs, it executes as a specific user (configured in the job's "Run As" setting, which defaults to the job owner). If that user does not have at least CAN RUN permission on the saved query, Databricks returns an empty body rather than an authorization error. To check this, open the query, click Share, and confirm the Run As user has the appropriate permission level.&lt;/P&gt;
&lt;P&gt;3. The SQL warehouse assigned to the task does not match. The SQL Query task requires a SQL warehouse (serverless or pro). If there is a mismatch or the warehouse is not accessible to the Run As user, the query resolution can fail silently.&lt;/P&gt;
&lt;P&gt;RECOMMENDED STEPS TO RESOLVE&lt;/P&gt;
&lt;P&gt;1. Go to SQL &amp;gt; Queries in the Databricks workspace.&lt;BR /&gt;2. Locate the exact query referenced by your job task. Open it.&lt;BR /&gt;3. Confirm you see your CALL statement in the editor (e.g., CALL my_catalog.my_schema.my_procedure();).&lt;BR /&gt;4. Click Save to ensure it is persisted.&lt;BR /&gt;5. Click Share and verify the job's Run As user has CAN RUN or higher permission.&lt;BR /&gt;6. In the job configuration, confirm the SQL warehouse assigned to the task is a Pro or Serverless warehouse, and that the Run As user has access to it.&lt;BR /&gt;7. Re-run the job.&lt;/P&gt;
&lt;P&gt;ALTERNATIVE APPROACH: USE A SQL FILE TASK INSTEAD&lt;/P&gt;
&lt;P&gt;If you continue to have trouble with the SQL Query task type, consider switching to the SQL &amp;gt; File task type. Create a .sql file in your workspace containing your CALL statement:&lt;/P&gt;
&lt;P&gt;CALL my_catalog.my_schema.my_procedure();&lt;/P&gt;
&lt;P&gt;Then configure the job task as SQL &amp;gt; File and point it to that workspace file. This approach reads the file content directly and avoids the saved query resolution layer entirely. Based on your description, this pattern already works for you with the SQL File task type, so it may be the most straightforward path forward.&lt;/P&gt;
&lt;P&gt;REFERENCE&lt;/P&gt;
&lt;P&gt;Documentation on SQL task types in Jobs:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/jobs/sql" target="_blank"&gt;https://docs.databricks.com/aws/en/jobs/sql&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Documentation on query permissions:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/user/queries/index.html" target="_blank"&gt;https://docs.databricks.com/aws/en/sql/user/queries/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;A related community thread with the same "Query text can not be empty" error and resolution:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300" target="_blank"&gt;https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;</description>
    <pubDate>Sun, 08 Mar 2026 07:29:03 GMT</pubDate>
    <dc:creator>SteveOstrowski</dc:creator>
    <dc:date>2026-03-08T07:29:03Z</dc:date>
    <item>
      <title>code unit 1 line 1 statement, stored as Query - considered "empty" in Job TaskRun - fails [ADBricks]</title>
      <link>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/145724#M52568</link>
      <description>&lt;P&gt;Hi colleagues,&lt;/P&gt;&lt;P&gt;could someone explain, why a single line statement [CALL ...();] fails (considered "empty" in error message) when invoked by a Job's Task[SQL\Query] run?&lt;BR /&gt;- as shown on the attached screen:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/23405i87A2DB11B6FFF778/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The same statement, stored in (Notebook, Workspace File) is been invoked OK, by a corresponding (Task[Run\Notebook], Task[SQL\File]) and executed OK&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jan 2026 12:13:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/145724#M52568</guid>
      <dc:creator>ADBricksExplore</dc:creator>
      <dc:date>2026-01-29T12:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: code unit 1 line 1 statement, stored as Query - considered "empty" in Job TaskRun - fa</title>
      <link>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/146427#M52650</link>
      <description>&lt;P class=""&gt;When you configure a Databricks job with a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;task type: SQL → Query&lt;/STRONG&gt;, the job runs a saved SQL asset.&lt;/P&gt;&lt;P class=""&gt;If the query’s body wasn’t actually saved, or if the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Run As&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user doesn’t have permission to read it, Databricks loads an empty query and returns one of the following errors:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;“Query text cannot be empty”&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;“Unexpected empty statement”&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P class=""&gt;To fix this issue:&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;&lt;P class=""&gt;In Databricks, go to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SQL &amp;gt; Queries &amp;gt; My Queries&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Open the exact&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Query asset&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;referenced by the job.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Click&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Save&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to ensure the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CALL ...();&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;body is persisted.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Re-run the job.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here is a similar post from past -&amp;nbsp;&lt;A href="https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300" target="_blank" rel="noopener"&gt;https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Feb 2026 15:25:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/146427#M52650</guid>
      <dc:creator>pradeep_singh</dc:creator>
      <dc:date>2026-02-01T15:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: code unit 1 line 1 statement, stored as Query - considered "empty" in Job TaskRun - fa</title>
      <link>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/150178#M53289</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/211345"&gt;@ADBricksExplore&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;This behavior where a CALL statement works from a Notebook or SQL File task but fails with an "empty" error from a SQL Query task comes down to how these task types resolve the SQL content at runtime.&lt;/P&gt;
&lt;P&gt;UNDERSTANDING THE DIFFERENCE BETWEEN SQL TASK TYPES&lt;/P&gt;
&lt;P&gt;When you configure a job task as SQL &amp;gt; Query, the task references a saved query asset stored in the Databricks SQL workspace (visible under SQL &amp;gt; Queries). At runtime, the job fetches the body of that saved query object and sends it to the SQL warehouse for execution.&lt;/P&gt;
&lt;P&gt;When you use SQL &amp;gt; File, the task reads the .sql file directly from your workspace or Git repo. And when you use a Notebook task, it executes the notebook cell contents directly. Both of these read the content from the file system rather than from the saved query store.&lt;/P&gt;
&lt;P&gt;WHY THE "EMPTY" ERROR OCCURS&lt;/P&gt;
&lt;P&gt;There are a few common reasons the SQL Query task sees an "empty" body even though you can see content in the editor:&lt;/P&gt;
&lt;P&gt;1. The query was not explicitly saved. If you typed or pasted your CALL statement into the SQL editor but never clicked the Save button (or if Save silently failed), the query object in the backend may have an empty body. The editor can show unsaved content in your browser session, but the job fetches the persisted version. Open the query in SQL &amp;gt; Queries &amp;gt; My Queries, verify your CALL statement appears, and click Save explicitly.&lt;/P&gt;
&lt;P&gt;2. The "Run As" user lacks permission to read the query. When a job runs, it executes as a specific user (configured in the job's "Run As" setting, which defaults to the job owner). If that user does not have at least CAN RUN permission on the saved query, Databricks returns an empty body rather than an authorization error. To check this, open the query, click Share, and confirm the Run As user has the appropriate permission level.&lt;/P&gt;
&lt;P&gt;3. The SQL warehouse assigned to the task does not match. The SQL Query task requires a SQL warehouse (serverless or pro). If there is a mismatch or the warehouse is not accessible to the Run As user, the query resolution can fail silently.&lt;/P&gt;
&lt;P&gt;RECOMMENDED STEPS TO RESOLVE&lt;/P&gt;
&lt;P&gt;1. Go to SQL &amp;gt; Queries in the Databricks workspace.&lt;BR /&gt;2. Locate the exact query referenced by your job task. Open it.&lt;BR /&gt;3. Confirm you see your CALL statement in the editor (e.g., CALL my_catalog.my_schema.my_procedure();).&lt;BR /&gt;4. Click Save to ensure it is persisted.&lt;BR /&gt;5. Click Share and verify the job's Run As user has CAN RUN or higher permission.&lt;BR /&gt;6. In the job configuration, confirm the SQL warehouse assigned to the task is a Pro or Serverless warehouse, and that the Run As user has access to it.&lt;BR /&gt;7. Re-run the job.&lt;/P&gt;
&lt;P&gt;ALTERNATIVE APPROACH: USE A SQL FILE TASK INSTEAD&lt;/P&gt;
&lt;P&gt;If you continue to have trouble with the SQL Query task type, consider switching to the SQL &amp;gt; File task type. Create a .sql file in your workspace containing your CALL statement:&lt;/P&gt;
&lt;P&gt;CALL my_catalog.my_schema.my_procedure();&lt;/P&gt;
&lt;P&gt;Then configure the job task as SQL &amp;gt; File and point it to that workspace file. This approach reads the file content directly and avoids the saved query resolution layer entirely. Based on your description, this pattern already works for you with the SQL File task type, so it may be the most straightforward path forward.&lt;/P&gt;
&lt;P&gt;REFERENCE&lt;/P&gt;
&lt;P&gt;Documentation on SQL task types in Jobs:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/jobs/sql" target="_blank"&gt;https://docs.databricks.com/aws/en/jobs/sql&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Documentation on query permissions:&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/sql/user/queries/index.html" target="_blank"&gt;https://docs.databricks.com/aws/en/sql/user/queries/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;A related community thread with the same "Query text can not be empty" error and resolution:&lt;BR /&gt;&lt;A href="https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300" target="_blank"&gt;https://community.databricks.com/t5/data-engineering/workflow-sql-task-query-showing-empty/td-p/107300&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;* This reply used an agent system I built to research and draft this response based on the wide set of documentation I have available and previous memory. I personally review the draft for any obvious issues and for monitoring system reliability and update it when I detect any drift, but there is still a small chance that something is inaccurate, especially if you are experimenting with brand new features.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2026 07:29:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/code-unit-1-line-1-statement-stored-as-query-considered-quot/m-p/150178#M53289</guid>
      <dc:creator>SteveOstrowski</dc:creator>
      <dc:date>2026-03-08T07:29:03Z</dc:date>
    </item>
  </channel>
</rss>

