Skip to main content

csvql

Query CSV files with SQL from the terminal.

No database to set up, no Python library to learn — just csvql data.csv and write SELECT.

pip install csvql

# Count and aggregate
csvql sales.csv -q "SELECT region, COUNT(*) as orders, SUM(amount) as revenue FROM sales GROUP BY region ORDER BY 2 DESC"

# Inspect columns
csvql --tables messy_data.csv

# JSON output (pipe into jq)
csvql --json data.csv -q "SELECT * FROM data WHERE status = 'active'"

# Custom delimiter
csvql -d';' data.tsv -q "SELECT * FROM data"

How it works

Loads each CSV into an in-memory SQLite table, runs your SQL, and prints the result. Zero external dependencies — uses only Python's stdlib csv, sqlite3, and json modules.

Column names are derived from the header row. Tables are named after the file name. Multiple files can be queried together if they share the same path prefix.

Why

Every data worker has the muscle memory for SQL but reaches for grep, awk, or a spreadsheet when the data happens to be in CSV. csvql lets you use SQL directly.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

csv_query_cli-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file csv_query_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: csv_query_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for csv_query_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8cf5b952eed58a1aec1dd0a195b1b0401665464215b52553c4003414e0ba1d5
MD5 657f5d07a35d94627ba6bc3c74792710
BLAKE2b-256 57d2972af8f023437f993ae061a2c99bb575c40b0f09b5f67e6a08e3aed41f58

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page