SQL 将 Dbeaver 上的结果集导出为 CSV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43329790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Export result set on Dbeaver to CSV
提问by Rafael Meirelles
Normally I use Dbeaver for windows and always export my result set like this:
通常我在 Windows 上使用 Dbeaver 并且总是像这样导出我的结果集:
- 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:
问题是现在我使用 dbeaver for mac 并且本指南不起作用。我可以继续直到我选择我的结果集,如下图所示:
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.
通常我的查询会自动显示在那里,我在菜单中找不到任何可以纠正这个问题的选项。
回答by Sébastien Nussbaumer
You don't need to use the clipboard, you can export directly the whole resultset (not just what you see) to a file :
您不需要使用剪贴板,您可以将整个结果集(不仅仅是您看到的)直接导出到一个文件中:
- Execute your query
- Right click any anywhere in the results
- click "Export resultset..." to open the export wizard
- Choose the format you want (CSV according to your question)
- Review the settings in the next panes when clicking "Next". (No need to change anything in my case)
- Set the folder where the file will be created, and "Finish"
- 执行您的查询
- 右键单击结果中的任意位置
- 单击“导出结果集...”打开导出向导
- 选择您想要的格式(根据您的问题选择 CSV)
- 单击“下一步”时,查看下一个窗格中的设置。(在我的情况下无需更改任何内容)
- 设置将创建文件的文件夹,然后“完成”
The export runs in the background, a popup will appear when it's done.
导出在后台运行,完成后会出现一个弹出窗口。
In newer versions of DBeaver you can just :
在较新版本的 DBeaver 中,您可以:
- right click the SQL of the query you want to export
- Execute > Export from query
- Choose the format you want (CSV according to your question)
- Review the settings in the next panes when clicking "Next". (No need to change anything in my case)
- Set the folder where the file will be created, and "Finish"
- 右键单击要导出的查询的 SQL
- 执行 > 从查询导出
- 选择您想要的格式(根据您的问题选择 CSV)
- 单击“下一步”时,查看下一个窗格中的设置。(在我的情况下无需更改任何内容)
- 设置将创建文件的文件夹,然后“完成”
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.
与之前的导出方式相比,这节省了您执行时间/资源密集型查询的第 1 步(执行查询)。
回答by Rafael Meirelles
The problem was the box "open new connection" that was checked. So I couldn't use my temporary table.
问题是选中了“打开新连接”框。所以我不能使用我的临时表。
回答by Kyle
Is there a reason you couldn't select your results and right click and choose Advanced Copy -> Advanced Copy? I'm on a Mac and this is how I always copy results to the clipboard for pasting.
是否存在无法选择结果并右键单击并选择“高级复制”->“高级复制”的原因?我在 Mac 上,这就是我总是将结果复制到剪贴板进行粘贴的方式。