Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export result set on Dbeaver to CSV

Tags:

sql

csv

dbeaver

Normally I use Dbeaver for windows and always export my result set like this:

  • Run my query --> select the result --> export the result set --> select export to clipboard --> done

This step by step puts my result set in my clipboard and I can paste it wherever I want to work with it.

The problem is that now I am using dbeaver for mac and this guide is not working. I can go on until the moment that I select my result set like in the image below:

exporting data set

But once I go further in the process, in the last step I get: no query

Note that in "source" it was suppose to show the query that originated the result set, but instead it says just "select.

As a result it does't select my result or anything (besides being "successful").

Normally my query would show up there automatically and I couldn't find any option that corrects this problem in the menus.

like image 566
Rafael Meirelles Avatar asked Apr 10 '17 17:04

Rafael Meirelles


People also ask

How do I export DBeaver query results?

Select Window / Preferences / DBeaver / Editors / Data Editor / Lob Editors binary data formatter and select “Hex”. Right click on all of the results of the query. Note: For some tables where comma delimited is not useful (example inventory tables) just copy the results and paste into Excel. Select Export Data…

How do I export SQL to CSV?

Step 1: First of all, start SQL Server Management Studio and connect to the database. Step 2: Next, under Object Explorer search for the database you want to export data in CSV. Step 3: Right-click on the desired database >> go to Tasks >> Export Data.


3 Answers

You don't need to use the clipboard, you can export directly the whole resultset (not just what you see) to a file :

  1. Execute your query
  2. Right click any anywhere in the results
  3. click "Export resultset..." to open the export wizard
  4. Choose the format you want (CSV according to your question)
  5. Review the settings in the next panes when clicking "Next".
  6. Set the folder where the file will be created, and "Finish"

The export runs in the background, a popup will appear when it's done.


In newer versions of DBeaver you can just :

  1. right click the SQL of the query you want to export
  2. Execute > Export from query
  3. Choose the format you want (CSV according to your question)
  4. Review the settings in the next panes when clicking "Next".
  5. Set the folder where the file will be created, and "Finish"

The export runs in the background, a popup will appear when it's done.

Compared to the previous way of doing exports, this saves you step 1 (executing the query) which can be handy with time/resource intensive queries.

like image 122
Sébastien Nussbaumer Avatar answered Sep 28 '22 03:09

Sébastien Nussbaumer


The problem was the box "open new connection" that was checked. So I couldn't use my temporary table.

like image 24
Rafael Meirelles Avatar answered Sep 28 '22 03:09

Rafael Meirelles


In version 21.0 / Release date march 1, 2021

  1. right click the SQL of the query you want to export
  2. Export data
  3. From query Choose the format you want (CSV according to your question)
  4. Review the settings in the next panes when clicking "Next".
  5. Set the folder where the file will be created, and "Finish"
like image 21
Consule Avatar answered Sep 28 '22 02:09

Consule