3 ms·
Hi HN, I built `sql-pipe` because I often need to filter or aggregate CSV data in the terminal, and I found the existing options lacking: - `awk` syntax effect
by vmvarela 8mo ago
Hi HN,
I built `sql-pipe` because I often need to filter or aggregate CSV data in the terminal, and I found the existing options lacking:
- `awk` syntax effectively requires learning a new language for complex logic.
- Pandas/Python scripts are heavy and slow to spin up for one-liners.
- The standard `sqlite3` CLI requires multiple commands (.mode csv, .import) before you can run a query.
sql-pipe converts stdin (CSV/TSV) into an in-memory SQLite table named `t` on the fly, auto-detects column types (so you can sum/avg integers directly), and outputs the result back to stdout.
It's written in Zig, statically links SQLite (zero dependencies), and is cross-compiled for Linux/macOS/Windows.
Example usage:
curl -s https://example.com/data.csv https://example.com/data.csv | sql-pipe "SELECT region, SUM(revenue) FROM t GROUP BY 1 ORDER BY 2 DESC"
The repo is here: https://github.com/vmvarela/sql-pipe https://github.com/vmvarela/sql-pipe
Happy to answer any questions about the Zig implementation or the SQLite integration!