csvql-query
Query CSV files with SQL from Python — powered by a Zig/SIMD engine.
Zero-copy mmap reads + SIMD parsing happen before Python ever sees the data. Faster than DuckDB on typical workloads, no dependencies required.
Installation
pip install csvql-query
Quick Start
import csvql
# Returns a list of dicts (like csv.DictReader, but with SQL)
rows = csvql.query("SELECT name, salary FROM 'employees.csv' WHERE salary > 100000 ORDER BY salary DESC")
# [{'name': 'Alice', 'salary': '185000'}, ...]
# Raw CSV string
csv_str = csvql.query_csv("SELECT * FROM 'data.csv' LIMIT 10")
# pandas DataFrame (pandas must be installed)
df = csvql.query_df("SELECT category, COUNT(*) as n FROM 'sales.csv' GROUP BY category")
# (headers, rows) tuples — no dependencies
headers, rows = csvql.query_tuples("SELECT name, age FROM 'users.csv' WHERE age > 25")
API
| Function | Returns | Description |
|---|---|---|
query(sql) |
list[dict] |
Execute SQL, get list of dicts |
query_csv(sql) |
str |
Execute SQL, get raw CSV string |
query_df(sql) |
DataFrame |
Execute SQL, get pandas DataFrame |
query_tuples(sql) |
(list[str], list[tuple]) |
Execute SQL, get (headers, rows) |
SQL Support
The SQL path is embedded in the query string (same as the CLI):
# Filtering, ordering, limiting
csvql.query("SELECT name, city FROM 'data.csv' WHERE age > 30 ORDER BY name LIMIT 5")
# Aggregation
csvql.query("SELECT department, AVG(salary) FROM 'emp.csv' GROUP BY department")
# Unix pipes — use '-' as the filename
import subprocess, sys
# or just pass stdin data via the engine directly
Full SQL reference: SIMPLE_QUERY_LANGUAGE.md
Performance
- mmap + SIMD parsing — data is never copied into Python memory
- Parallel chunk processing on multi-core machines
- Typically 5–9x faster than DuckDB on 1M-row CSVs
Requirements
- Python ≥ 3.10
- macOS (x86_64 / arm64) or Linux (x86_64)
pandasoptional — only needed forquery_df()
Links
Metadata
Release files for csvql-query 2.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| csvql_query-2.8.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| csvql_query-2.8.0-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| csvql_query-2.8.0-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| csvql_query-2.8.0-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| csvql_query-2.8.0-py3-none-macosx_12_0_arm64.whl | Python 3 | none | macOS 12.0+ ARM64 | Details |
Total release size: 4.3 MB
Release files / csvql_query-2.8.0-py3-none-win_amd64.whl
| Download URL | csvql_query-2.8.0-py3-none-win_amd64.whl |
|---|---|
| Size | 535.2 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8579ea5f8798fb1504314dbfb0caa8b6bd8ae317c5581a53ad24dee88b49f691
|
|
BLAKE2b-256 checksum How to use checksums |
9c2f1969f4568ae5ba8ab92a47c96a04259ce525387176c1917a44bfc136ed9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / csvql_query-2.8.0-py3-none-manylinux_2_17_x86_64.whl
| Download URL | csvql_query-2.8.0-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
9aee9150c5efc51644015d9c02c6ede25b33c316f69085a9365173a8b61307be
|
|
BLAKE2b-256 checksum How to use checksums |
ca2068e77c1ef77445ceeb88253c97f4e44be9e596906d3b27c1128693b643dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / csvql_query-2.8.0-py3-none-manylinux_2_17_aarch64.whl
| Download URL | csvql_query-2.8.0-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
008c2d3bef9dc2a7db9cbcba5a7cb2455deb4c431ec62b4465d35cd5a30aa15a
|
|
BLAKE2b-256 checksum How to use checksums |
9e69ea1850ba29912c8e4e49f47f86768f3eb744e177915f027eae54a55c33ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / csvql_query-2.8.0-py3-none-macosx_12_0_x86_64.whl
| Download URL | csvql_query-2.8.0-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 371.4 kB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
065b745de804ce55ba28e71ba73781d6acf66ba2d7d0a4499cff1f4e710e2def
|
|
BLAKE2b-256 checksum How to use checksums |
e435cf5f3e5e5378af2b993da4553189f44a357355c5c134bda5c26fb08c92df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / csvql_query-2.8.0-py3-none-macosx_12_0_arm64.whl
| Download URL | csvql_query-2.8.0-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 371.4 kB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
662773af62c03bcfd8cde99c8e5bc383745fcde172a75cb5838db380fb0e68a5
|
|
BLAKE2b-256 checksum How to use checksums |
664af5154eefc29666d354c021de1cbdffb7c64c5197e053f265d9fc7574675d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|