<?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: Convert SQL Query to Dataframe in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/81341#M36275</link>
    <description>&lt;P&gt;From a pyspark notebook, you could do:&lt;BR /&gt;&lt;BR /&gt;df = spark.sql("SELECT * FROM my_table WHERE ...")&lt;BR /&gt;&lt;BR /&gt;Then you can use this df and crossjoin it to another DataFrame&lt;BR /&gt;&lt;BR /&gt;If you are new to databricks, I suggest you should follow some of the self paced lessons in databricks-academy, it helped me a lot when I started. For example:&lt;A href="https://www.databricks.com/training/catalog/apache-spark-programming-with-databricks-1875" target="_blank"&gt;&amp;nbsp;https://www.databricks.com/training/catalog/apache-spark-programming-with-databricks-1875&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2024 14:40:21 GMT</pubDate>
    <dc:creator>Antoine_B</dc:creator>
    <dc:date>2024-07-31T14:40:21Z</dc:date>
    <item>
      <title>Convert SQL Query to Dataframe</title>
      <link>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/81339#M36274</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hello,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Being relatively new to the Databricks world, I'm hoping someone can show me how to take a SQL query and put the results into a dataframe. As part of data validation project, I'd like to cross join two dataframes.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 14:25:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/81339#M36274</guid>
      <dc:creator>143260</dc:creator>
      <dc:date>2024-07-31T14:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SQL Query to Dataframe</title>
      <link>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/81341#M36275</link>
      <description>&lt;P&gt;From a pyspark notebook, you could do:&lt;BR /&gt;&lt;BR /&gt;df = spark.sql("SELECT * FROM my_table WHERE ...")&lt;BR /&gt;&lt;BR /&gt;Then you can use this df and crossjoin it to another DataFrame&lt;BR /&gt;&lt;BR /&gt;If you are new to databricks, I suggest you should follow some of the self paced lessons in databricks-academy, it helped me a lot when I started. For example:&lt;A href="https://www.databricks.com/training/catalog/apache-spark-programming-with-databricks-1875" target="_blank"&gt;&amp;nbsp;https://www.databricks.com/training/catalog/apache-spark-programming-with-databricks-1875&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 14:40:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/81341#M36275</guid>
      <dc:creator>Antoine_B</dc:creator>
      <dc:date>2024-07-31T14:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SQL Query to Dataframe</title>
      <link>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/104150#M41670</link>
      <description>&lt;P&gt;Just to add here. So this is using the&amp;nbsp;&lt;SPAN&gt;library&lt;/SPAN&gt;&lt;SPAN&gt;(SparkR) package. My code is below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;library&lt;/SPAN&gt;&lt;SPAN&gt;(SparkR)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df = sql(&lt;/SPAN&gt;&lt;SPAN&gt;"SELECT * FROM TABLE_SCHEMA.TABLE_NAME"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;the comment above did not work directly for me. Hope this helps.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Jan 2025 20:15:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/convert-sql-query-to-dataframe/m-p/104150#M41670</guid>
      <dc:creator>tt_mmo</dc:creator>
      <dc:date>2025-01-03T20:15:11Z</dc:date>
    </item>
  </channel>
</rss>

