tursodatabase / turso-cli

Command line interface to Turso.
https://turso.tech
MIT License
224 stars 37 forks source link

Support CSV export of a query #769

Open avinassh opened 10 months ago

avinassh commented 10 months ago

I am trying to write a bash script to extract some data from the database in csv format and typically I would do this as

sqlite3 my.db ".mode csv" ".headers on" "$sql_query"

Unfortunately, this doesn't work using the turso CLI (Error: accepts between 1 and 2 arg(s), received 3)

turso db shell my-db ".mode csv" "$sql_query"

reported here: https://discord.com/channels/933071162680958986/1193507982076547082/1193507982076547082

Mr-Destructive commented 8 months ago

Could this be done by adding a new flag? Example like a --query-cmds flag followed by a list of strings/commands

turso db shell my-db --query-cmds ".mode csv" ".head on" "$sql_query"