SQL against CSV, TSV, LTSV, JSON, JSONL, Parquet, Excel, ACH, and Fedwire
sqly runs SQL against CSV, TSV, LTSV, JSON, JSONL, Parquet, Excel, ACH, and Fedwire files. It loads them into an in-memory SQLite database, so joins, CTEs, window functions, and aggregates work across formats in one query.

Try it in 30 seconds #
printf 'name,dept,salary\nalice,eng,120\nbob,sales,90\ncarol,eng,140\n' > staff.csv
go run github.com/nao1215/sqly@latest --sql "SELECT dept, ROUND(AVG(salary)) AS avg FROM staff GROUP BY dept" staff.csv
+-------+-----+
| dept | avg |
+-------+-----+
| eng | 130 |
| sales | 90 |
+-------+-----+
The file is the table: staff.csv became staff, with no schema to write.
Next steps #
sqly --output-format json --sql "SELECT * FROM staff" --output staff.json staff.csv # convert
sqly --sql "SELECT * FROM a JOIN b ON a.id = b.id" a.csv b.parquet # join across formats
sqly staff.csv # open the shell
The cookbook has the rest: JSON extraction, Excel sheets, HTTP inputs, inspecting data, writing changes back, and MySQL/PostgreSQL/BigQuery syntax.
Use it in a pipe #
sqly reads standard input, and its non-table output formats are meant for the next command:
curl -s https://example.com/sales.csv | sqly --stdin-format csv --sql "SELECT region, SUM(amount) FROM stdin GROUP BY region"
sqly --output-format jsonl --sql "SELECT path FROM logs WHERE status >= 500" logs.csv | jq -r '.path'
sqly --output-format tsv --sql "SELECT status, path FROM logs" logs.csv | cut -f1 | sort -rn | head -n 1
Filter with WHERE, GROUP BY, and JOIN in SQL, and jq only sees the rows you kept. For nested JSON, json_extract reaches into the document, so sqly can replace jq there. A failed query exits non-zero, but in a pipeline the shell reports the last command’s status, so use pipefail if set -e should stop on it. Pipe data out has the details.
Why sqly? #
| You want | Use |
|---|---|
| A field-oriented text processor for logs and columns | awk, Miller |
| A CSV-native SQL dialect with its own engine and cursors | csvq |
| SQL over CSV/TSV/JSON with a choice of backend engines | trdsql |
| SQL over CSV with mature Python tooling | q, textql |
| Analytics on data larger than memory, or on files in S3 | DuckDB |
| SQL over files, with an interactive shell, cross-format joins, and write-back | sqly |
sqly is built around the session: an interactive shell with completion and history, files of different formats joined as peers, and edits written back into the source file.
DuckDB is faster and has the richer SQL. What sqly adds over it is narrower: UPDATE a CSV or Excel file and .save --in-place it, read ACH, Fedwire and LTSV, keep a Shift-JIS or EUC-JP file in its encoding when it is saved, and write queries in MySQL, PostgreSQL or GoogleSQL syntax with --dialect.
The shell #
sqly with no --sql opens a REPL. Tab completes keywords, table names, and paths, history persists across sessions, and dot-commands cover what SQL has no syntax for.

sqly:~/data(table)$ .import user.csv
sqly:~/data(table)$ SELECT user_name FROM user
...> WHERE identifier = 1;
sqly:~/data(table)$ .mode json
sqly:~/data(json)$ .save ./out
See Shell for every dot-command.
Install #
go install github.com/nao1215/sqly@latest
Homebrew, Scoop, the AUR, aqua, mise, and prebuilt binaries are on the install page.