bugGNU Parallel - Bugs: bug #49843, --csv as output for GNU sql


bug #49843: --csv as output for GNU sql

Submitter:  Ole Tange <tange>
Submitted:  Wed 14 Dec 2016 05:59:52 PM UTC
Category:  None Severity:  1 - Wish
Item Group:  None Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Fri 16 Dec 2016 02:08:06 AM UTC, comment #1: 

A better approach is to use an SQLite-base and then convert that to CSV:

         parallel --sqlandworker $DBTABLEURL seq ::: {1..10}
         sql $DBURL '.headers on' '.mode csv' 'select * from mytable;'

       This takes around a second per job.

       If you have access to a real database system, such as PostgreSQL, it is even

         parallel --sqlandworker $DBTABLEURL seq ::: {1..10}
         sql $DBURL "COPY (SELECT * FROM mytable) TO stdout DELIMITER ',' CSV HEADER;"

       Or MySQL:

         parallel --sqlandworker $DBTABLEURL seq ::: {1..10}
         sql -p -B $DBURL "SELECT * FROM mytable;" > mytable.tsv
         perl -pe 's/"/""/g;s/\t/","/g;s/^/"/;s/$/"/;s/\\\\/\\/g;s/\\t/\t/g;s/\\n/\n/g;' mytable.tsv

Ole Tange <tange>
Group administrator
Wed 14 Dec 2016 05:59:52 PM UTC, original submission:  

sql --csv $DBURL/table

Ole Tange <tange>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by tange (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13.
    Corresponding source code