<?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 query is not returning _sqldf. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109262#M43262</link>
    <description>&lt;P&gt;I switched my notebook back to all purpose compute as _sqldf is not supported with sql warehouse notebook. It didn't work as explained above.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2025 17:32:31 GMT</pubDate>
    <dc:creator>Somia</dc:creator>
    <dc:date>2025-02-06T17:32:31Z</dc:date>
    <item>
      <title>sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/108970#M43189</link>
      <description>&lt;P&gt;Notebooks in my workspace are not returning _sqldf when a sql query is run.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If I run this code, it would give an error in second cell that _sqldf is not defined.&lt;BR /&gt;&lt;BR /&gt;First Cell:&lt;/P&gt;&lt;P&gt;%sql&lt;/P&gt;&lt;P&gt;select * from some_table limit 10&lt;BR /&gt;&lt;BR /&gt;Second Cell:&lt;/P&gt;&lt;P&gt;%sql&lt;/P&gt;&lt;P&gt;select * from _sqldf&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However, the same code runs fine in other people's notebook in my organization. I suspect it started when I connected my notebook with sql warehouse as my whole notebook was in sql rather than an all purpose compute. Now I cannot run this above code even when I make a new notebook.&lt;BR /&gt;&lt;BR /&gt;Can anybody suggest how to fix this.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 14:42:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/108970#M43189</guid>
      <dc:creator>Somia</dc:creator>
      <dc:date>2025-02-05T14:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/108974#M43192</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/147940"&gt;@Somia&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;If you run that function in all-purpose does it work fine?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 14:53:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/108974#M43192</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2025-02-05T14:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109262#M43262</link>
      <description>&lt;P&gt;I switched my notebook back to all purpose compute as _sqldf is not supported with sql warehouse notebook. It didn't work as explained above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 17:32:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109262#M43262</guid>
      <dc:creator>Somia</dc:creator>
      <dc:date>2025-02-06T17:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109299#M43266</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/147940"&gt;@Somia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To replicate your scenario, you need an All-Purpose Cluster and a notebook defaulted to python language. Then query a table using %sql as below. This creates a temp dataframe for you to use it in the python cells. Keep in mind, that this dataframe keep changing as you execute a different %sql cell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;%sql
-- cell 1
select * from catalog.schema.123_sample&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;# cell 2
display(_sqldf)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MadhuB_1-1738873741814.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/14680iC4A49C355A91CB23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MadhuB_1-1738873741814.png" alt="MadhuB_1-1738873741814.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To summarize, the %sql magic command behaves differently depending on whether your Databricks notebook is connected to an All-Purpose cluster or a SQL Warehouse.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;All-Purpose Cluster: %sql creates a DataFrame named _sqldf that you can use in subsequent Python cells.&lt;/LI&gt;&lt;LI&gt;SQL Warehouse: %sql executes the query but does not create the _sqldf DataFrame.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;BR /&gt;Please let me know for anything, else mark it as a &lt;STRONG&gt;solution&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 20:33:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109299#M43266</guid>
      <dc:creator>MadhuB</dc:creator>
      <dc:date>2025-02-06T20:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109319#M43274</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/147940"&gt;@Somia&lt;/a&gt;&amp;nbsp;_sqldf is a pyspark df not a sql object.&lt;/P&gt;&lt;P&gt;It works only for such direction&amp;nbsp;&lt;/P&gt;&lt;P&gt;exec sql -&amp;gt; call _sqldf in pyspark&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 22:19:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109319#M43274</guid>
      <dc:creator>JakubSkibicki</dc:creator>
      <dc:date>2025-02-06T22:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109407#M43304</link>
      <description>&lt;P&gt;Changing the notebook to default python and all purpose compute have fixed the issue. I am able to access _sqldf in subsequent sql or python cell.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 13:41:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109407#M43304</guid>
      <dc:creator>Somia</dc:creator>
      <dc:date>2025-02-07T13:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109438#M43319</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/147940"&gt;@Somia&lt;/a&gt;&amp;nbsp;Can you mark my detailed explanation as solution that helped to resolve your issue.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 18:07:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/109438#M43319</guid>
      <dc:creator>MadhuB</dc:creator>
      <dc:date>2025-02-07T18:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: sql query is not returning _sqldf.</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/124340#M47156</link>
      <description>&lt;P&gt;Is there any equivalent to _sqldf for SQL Warehouses?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jul 2025 14:45:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-query-is-not-returning-sqldf/m-p/124340#M47156</guid>
      <dc:creator>pdiamond</dc:creator>
      <dc:date>2025-07-07T14:45:54Z</dc:date>
    </item>
  </channel>
</rss>

