News for hackers. Stuff that matters.
Re:Sq.io: jq for databases and more by varenc on Sunday October 06, 2024 @07:58PM (#41761448)
I find sq handy when you use it to accomplish things you can't (easily) do with just raw SQL. Things like: exporting certain rows to JSON or CSV, transforming rows into nicely formatted log lines for viewing, or reading in a CSV file and querying it the same way you'd query other databases. It's particularly easy to start using if you're already familiar with the jq.

If you use things like `array_to_json(array_agg(row_to_json(....)))` in your psql commands to output some rows to JSON, then sq's `--json` or `--jsonl` is quite a bit easier IMHO. If you know the exact SQL query you want to run you can just do `sq sql '....'` as well, but I agree there's not much point in doing that if you aren't taking advantage of some other sq feature.

Re:Sq.io: jq for databases and more by maxfurman on Sunday October 06, 2024 @08:02PM (#41761470)
You may know this already, but the SQLite CLI can actually read and query data directly from a csv file, with the right flags
Re:Sq.io: jq for databases and more by ec109685 on Monday October 07, 2024 @02:12AM (#41763225)
They are Jedi’s at jq though.
Re:Sq.io: jq for databases and more by aurareturn on Monday October 07, 2024 @01:33AM (#41763076)
I agree with @candiddevmike. Might I add that you can do those things fairly easily now with ChatGPT/Claude. I doubt LLMs know how to use Sq.io that much.