<?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: How can I export a result of a SQL query from a databricks notebook? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30343#M21981</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can also write to dbfs:/FileStore/download.csv, and then download by going to &lt;A href="https://community.cloud.databricks.com/files/download.csv" target="test_blank"&gt;https://community.cloud.databricks.com/files/download.csv&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2017 18:24:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-08-28T18:24:47Z</dc:date>
    <item>
      <title>How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30340#M21978</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The "Download CSV" button in the notebook seems to work only for results &amp;lt;=1000 entries. How can I export larger result-sets as CSV? &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 11:19:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30340#M21978</guid>
      <dc:creator>gianni77</dc:creator>
      <dc:date>2015-07-29T11:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30341#M21979</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi, &lt;/P&gt;
&lt;P&gt;You can write the results back to S3 and download them from directly from S3. Our DB Guide notebooks should have a sample for you to look at. Please search for Download All SQL and you should see Scala and python examples. &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2015 16:58:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30341#M21979</guid>
      <dc:creator>User16301467534</dc:creator>
      <dc:date>2015-07-31T16:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30342#M21980</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;It woul be really great if you could add a simple option to download a table in the "data" tab. As a data scientist, I can say this is a pretty basic part of the data science process -- for example if you are building documentation or whitepapers for a model, you will need samples of data, correlation matrices, etc. &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 17:13:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30342#M21980</guid>
      <dc:creator>PaulLintilhac</dc:creator>
      <dc:date>2017-08-24T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30343#M21981</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can also write to dbfs:/FileStore/download.csv, and then download by going to &lt;A href="https://community.cloud.databricks.com/files/download.csv" target="test_blank"&gt;https://community.cloud.databricks.com/files/download.csv&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 18:24:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30343#M21981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-28T18:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30344#M21982</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi doug, &lt;/P&gt;
&lt;P&gt;Can you provide more details on this? Not sure how to write to the filestore. &lt;/P&gt;
&lt;P&gt;Thanks. &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2019 06:57:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30344#M21982</guid>
      <dc:creator>jiaxuan</dc:creator>
      <dc:date>2019-05-30T06:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30345#M21983</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;yes, would you please provide more in detail on this? the link is not working (HTTP ERROR: 404" thank you&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 15:27:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30345#M21983</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2020-02-18T15:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30346#M21984</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I have asked this question before since the link is broken.&lt;/P&gt;
&lt;P&gt;How do I export sql query into csv and send email out. Also, how can I select a billion records in csv. Databrick allows to export only max a million record but we have 1.5 billion&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 19:16:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30346#M21984</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2020-06-03T19:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30347#M21985</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;I usually use pyspark to do such action. Some example code of how I write it to DBFS from a pyspark data frame:&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;data_frame.coalesce(1).write.format("com.databricks.spark.csv").save("/FileStore/tables/your_file_name.csv")
&lt;P&gt;If you are curious how to transfer from straight SQL to pyspark, you can try creating a temporary table within SQL and then reading it into a pyspark data frame to then write it out. Below code is given you have imported the respective libraries.&lt;/P&gt;
&lt;P&gt;%python&lt;/P&gt;
&lt;P&gt;data_frame = spark.table("your_temp_table")&lt;/P&gt;
&lt;P&gt;Please note I normally do not have export data of this size. You may need to research more the coalesce function and may be required to combine multiple csv files. &lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 15:02:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30347#M21985</guid>
      <dc:creator>ColbyCarrillo</dc:creator>
      <dc:date>2020-06-10T15:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30348#M21986</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;After rereading your question, this is quite simple, when downloading a csv from the notebook there will be a down arrow indicator on the right side of the symbol. All you need to do is click that drop down and click download full results (1,000,000 max)&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 01:49:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30348#M21986</guid>
      <dc:creator>ColbyCarrillo</dc:creator>
      <dc:date>2020-06-11T01:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30349#M21987</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Cobly,&lt;/P&gt;
&lt;P&gt;I know how to download a csv from a notebook via using a down arrow indicator on the bottom of the query. But I want to know how to create a script to pull the csv directly send out email and/or store directly in the indicate folder like oracle/mysql. Also, the query is about 1.5 billion records, 1 million max is not an option. &lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;Bach-Nga&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 02:31:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30349#M21987</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2020-06-11T02:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30350#M21988</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;To write to the filestore you'd do:&lt;/P&gt;
&lt;P&gt;df.write.option("header", "true").csv("dbfs:/FileStore/download.csv") and then download from&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.cloud.databricks.com/files/download.csv" target="test_blank"&gt;https://community.cloud.databricks.com/files/download.csv&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;However, Databricks now has the feature to just click "Download" when displaying a result-set, which the other answers below also mention. It will download the first 1 million rows.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 03:12:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30350#M21988</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-11T03:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30351#M21989</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can compose the outcomes back to S3 and download them from straightforwardly from S3. Our DB Guide note pads ought to have an example for you to take a gander at. If it's not too much trouble, look for Download All SQL and you should see Scala and python models.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 07:27:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30351#M21989</guid>
      <dc:creator>AlvinHoffman</dc:creator>
      <dc:date>2021-02-05T07:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30352#M21990</link>
      <description>&lt;P&gt;Now within the Databricks SQL interface (within the SQL editor)  you can actually download the full results as a csv. Just make sure to uncheck "LIMIT 1000" and then click the download button under "..." in the bottom left:&lt;span class="lia-inline-image-display-wrapper" image-alt="Screenshot of download button location"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2645i00F2EBA7CBC6B5D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot of download button location" alt="Screenshot of download button location" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 19:21:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/30352#M21990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-31T19:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I export a result of a SQL query from a databricks notebook?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/71054#M34229</link>
      <description>&lt;P&gt;If you have a large dataset, you might want to export it to a bucket in parquet format from your notebook:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%python

df = spark.sql("select * from your_table_name")
df.write.parquet(your_s3_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2024 19:14:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-can-i-export-a-result-of-a-sql-query-from-a-databricks/m-p/71054#M34229</guid>
      <dc:creator>igorstar</dc:creator>
      <dc:date>2024-05-29T19:14:02Z</dc:date>
    </item>
  </channel>
</rss>

