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.7.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.7.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| csvql_query-2.7.0-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| csvql_query-2.7.0-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| csvql_query-2.7.0-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| csvql_query-2.7.0-py3-none-macosx_12_0_arm64.whl | Python 3 | none | macOS 12.0+ ARM64 | Details |
Total release size: 4.2 MB
Release files / csvql_query-2.7.0-py3-none-win_amd64.whl
| Download URL | csvql_query-2.7.0-py3-none-win_amd64.whl |
|---|---|
| Size | 506.6 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8189a91a6aab3dcce850bde027d6ed776169581c79483410c1092238cee38bfd
|
|
BLAKE2b-256 checksum How to use checksums |
be9d1bcd36dafa220a62b584e5695d016d8a280f781de1e9835d4e59cb5ac957
|
| 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.7.0-py3-none-manylinux_2_17_x86_64.whl
| Download URL | csvql_query-2.7.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 |
891aa5bf882cf58e6effc3c37d0f165c9b6c67d806268318d0ef41755f881318
|
|
BLAKE2b-256 checksum How to use checksums |
6ed33ada69ca7c2497571e56d2d2b59fdfe5193295c6a41915fbfef6d0b75367
|
| 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.7.0-py3-none-manylinux_2_17_aarch64.whl
| Download URL | csvql_query-2.7.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 |
7a15db00f7dbceb1b6b312afb286cb8ab66fb8fe41864a2c64d5c51be178527e
|
|
BLAKE2b-256 checksum How to use checksums |
31be1b106a0ce91379896a18901431b3a8a0190fa54b0510949a18c4d93d7019
|
| 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.7.0-py3-none-macosx_12_0_x86_64.whl
| Download URL | csvql_query-2.7.0-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 357.0 kB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
f4c712074f3da9bce5a7d8518e83d756c06203364d0384ad17e1e66f10054fbf
|
|
BLAKE2b-256 checksum How to use checksums |
f4af9869b2261f66e991976d1dca35357afa383ab57204fe615fc3b7fc39058b
|
| 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.7.0-py3-none-macosx_12_0_arm64.whl
| Download URL | csvql_query-2.7.0-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 357.0 kB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
47d06d26b0f3cc7f160519ff2c372df8ff09100b886a348ffcb20a3f715e2a1b
|
|
BLAKE2b-256 checksum How to use checksums |
cc407e3509c0a0a81578da45606034d7a4b60e49d95311f2f48fbb3ecacfdc89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|