Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CSV format output #105

Open
AlexZhou1995 opened this issue Dec 26, 2022 · 1 comment
Open

Support CSV format output #105

AlexZhou1995 opened this issue Dec 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@AlexZhou1995
Copy link

dsq output as json format by default. Can we support the output in csv format.

Currently, I need to use the jq and sed to get the output of csv

dsq t1.csv t2.csv "select t1.*,t2.* from {0} t1 join {1} t2 on t1.id = t2.id" | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' | sed -e 's/"//g' > result.csv

Can we support the output in csv format by --format

dsq --format csv t1.csv t2.csv "select t1.*,t2.* from {0} t1 join {1} t2 on t1.id = t2.id"
@AlexZhou1995 AlexZhou1995 added the bug Something isn't working label Dec 26, 2022
@labolado
Copy link

dsq *** | dasel -r json -w csv

https://github.com/TomWright/dasel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants