CSV SQL Query
Run SQL on CSV, TSV, JSON, Parquet and log files (nginx, Apache, syslog) with DuckDB.
Install
irm https://raw.githubusercontent.com/chayprabs/localtools/main/csv-sql-query/install.ps1 | iexlocaltools-csv-sql-query updatelocaltools-csv-sql-query uninstall
curl -fsSL https://raw.githubusercontent.com/chayprabs/localtools/main/csv-sql-query/install.sh | bashlocaltools-csv-sql-query updatelocaltools-csv-sql-query uninstall
brew install chayprabs/localtools/localtools-csv-sql-querybrew upgrade localtools-csv-sql-querybrew uninstall localtools-csv-sql-query
scoop bucket add localtools https://github.com/chayprabs/homebrew-localtools; scoop install localtools-csv-sql-queryscoop update localtools-csv-sql-queryscoop uninstall localtools-csv-sql-query
winget install localtools.CsvSqlQuerywinget upgrade localtools.CsvSqlQuerywinget uninstall localtools.CsvSqlQuery
Opens at http://127.0.0.1:47105 in your browser. Run localtools-csv-sql-query --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.
Direct download
| Platform | File | Size |
|---|---|---|
| Windows x64 | csv-sql-query-1.0.4-windows-x64.zip | 32.3 MB |
| macOS Apple Silicon | csv-sql-query-1.0.4-macos-arm64.zip | 30.2 MB |
| macOS Intel | csv-sql-query-1.0.4-macos-x64.zip | 33.3 MB |
| Linux x64 | csv-sql-query-1.0.4-linux-x64.zip | 39.8 MB |
| Linux ARM64 | csv-sql-query-1.0.4-linux-arm64.zip | 36.0 MB |
SHA-256 checksums are in the release notes; the install scripts verify them for you.
See it
How to use
- Run localtools-csv-sql-query (or open CSV SQL Query from your app menu); it opens in your browser.
- Drop one or more files: CSV, TSV, JSON/JSONL, Parquet, XLSX, SQLite, or nginx/Apache/syslog logs. Each becomes a table named after the file, with its columns and types listed.
- Write SQL (DuckDB dialect) or click one of the example queries built from your columns, then press Run or Ctrl+Enter.
- Page through the result, check the plan with Explain or Explain analyze, and download the result as CSV, JSON, Parquet or XLSX.
- From a terminal: localtools-csv-sql-query query "SELECT ..." data.csv logs/access.log -o out.parquet, or localtools-csv-sql-query shell data.csv for an interactive DuckDB shell.
FAQ
How big can the files be?
Multi-gigabyte files work: DuckDB streams them and spills to disk. On a Windows laptop a 1 GB, 12-million-row CSV counts in 1.9 s and a GROUP BY with COUNT DISTINCT takes 1.2 s using under 1 GB of memory. In the browser, results of any size are paged 200 rows at a time.
Which log formats are understood?
nginx and Apache access logs (combined and common), syslog in RFC 3164 (with or without <PRI>, classic or RFC 3339 timestamps) and RFC 5424, and JSON-lines logs. They become typed tables (status INTEGER, time TIMESTAMPTZ, ...) with a line_no column; lines that do not match are counted and reported. Any other text file becomes a table of lines.
Can I join files of different formats?
Yes. Every file is a table in the same DuckDB database, so you can join a CSV with a Parquet file, a sheet of an .xlsx and an access log in one query. SQLite and DuckDB files are attached read-only as name.table.
Does my data leave my computer?
No. Everything runs locally with no network access: extension autoloading is off, and in the web UI DuckDB is locked to the uploaded files (it cannot read other paths, fetch URLs or change that setting). Session files are deleted when you close the page.
Why does my query fail with a line and column?
Errors come straight from DuckDB and are mapped to the position in your SQL; the UI selects the offending spot in the editor. For CSV data errors DuckDB reports the line number in the file.