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.1
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.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| csvql_query-2.8.1-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| csvql_query-2.8.1-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| csvql_query-2.8.1-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| csvql_query-2.8.1-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.1-py3-none-win_amd64.whl
| Download URL | csvql_query-2.8.1-py3-none-win_amd64.whl |
|---|---|
| Size | 534.6 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f5ef21e8ae9ebc6c906bee7828dbc01310c27c5007848668668f8b74b6076f13
|
|
BLAKE2b-256 checksum How to use checksums |
47453ba48e28c6088a90e94e4590e18ae87c229fe3cfd365e6308b5108bd388e
|
| 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.1-py3-none-manylinux_2_17_x86_64.whl
| Download URL | csvql_query-2.8.1-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 |
e70263600a6fd0e2d154a3889d231843d2aac013d88e2c03b4acedda7bfffe93
|
|
BLAKE2b-256 checksum How to use checksums |
7c738b2b4c2998610e984b8b210641ef99f9534fa88edbfc4dbe3a7b4b492420
|
| 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.1-py3-none-manylinux_2_17_aarch64.whl
| Download URL | csvql_query-2.8.1-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 |
08afb83a7982983a913831d6245608c4c6f2eca36d9cce5c83da1a4992806910
|
|
BLAKE2b-256 checksum How to use checksums |
8af8d88feafa8d16e440126fe9f15afd469e7045bf13a1d9bcff01a8a1d7217d
|
| 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.1-py3-none-macosx_12_0_x86_64.whl
| Download URL | csvql_query-2.8.1-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 372.5 kB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
fd53b852e30eb365d289cf928b82b2a7ae2878dd130ecd3e1f93f2cdd53b5299
|
|
BLAKE2b-256 checksum How to use checksums |
4a4caac61855bb8efd9d483bf679a3cf21a607a07d3857b27c01893d25996113
|
| 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.1-py3-none-macosx_12_0_arm64.whl
| Download URL | csvql_query-2.8.1-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 372.5 kB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
41fe70b98a4d86764eef847b1aa733780e47cae86726d75d6d7160dcda6070db
|
|
BLAKE2b-256 checksum How to use checksums |
d8f2c9c232a05b6bbba6ca5c992b7e33f6c748cfc10f2bc394a790c608f4e186
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|