Bash til.simonwillison.net

One-liner for running queries against CSV files with SQLite  ↦

Simon Willison figured out how to run a SQL query directly against a CSV file using the sqlite3 CLI:

sqlite3 :memory: -cmd '.mode csv' -cmd '.import taxi.csv taxi' \
  'SELECT passenger_count, COUNT(*), AVG(total_amount) FROM taxi GROUP BY passenger_count'

Ie TL;DR’d the one-liner for ya, but you’ll have to go to Simon’s site for the explainer.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00