Export selected columns in CSV?

1,034 views
Skip to first unread message

David Logan

unread,
Oct 12, 2011, 3:03:07 PM10/12/11
to seque...@googlegroups.com
Hi,
Is it possible to export only selected columns of a single table as a csv?  What I want is to exclude blob columns, but keep the rest.  Of course, I can write a SELECT statement for this, but I have *many* columns which make it prohibitive, and it would be so much easier to simply exclude the few blob columns.

Thanks for a great tool.
Dave

HansJB

unread,
Oct 13, 2011, 6:13:59 AM10/13/11
to seque...@googlegroups.com
Hi,

well, inside the interface it isn't yet possible but if you only want to exclude all BLOB fields then you can make usage of a self-written Bundle command à la:

- New Bundle for Bundle Scope "Data Table"

- Input: "Table Content (CSV)" and "exclude BLOB"

- Output: None

- Command: [the following is a BASH command]
cat > ~/Desktop/my_file_name.csv


This bundle will write the content of the current shown table in the "Content" view [which is passed to STDIN of the BASH command] to the file ~/Desktop/my_file_name.csv whereby any BLOB fields will be replaced by the string "BLOB" to conserve the internal table structure for the future. Of course, you can parse the result to replace the string "BLOB" as well via regular expressions or whatever.

Another chance is to query the current table via "SELECT * FROM 'current_table' LIMIT 1" to get the info of each column written to SP_QUERY_RESULT_META_FILE and build a new query which excludes all blob files and write result of that new query to a file.

More details you can find here:

http://www.sequelpro.com/docs/Bundle_Editor

http://www.sequelpro.com/docs/URL_scheme_sequelpro://_Usage

Best,
--Hans

Reply all
Reply to author
Forward
0 new messages