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.6.2
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.6.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| csvql_query-2.6.2-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| csvql_query-2.6.2-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| csvql_query-2.6.2-py3-none-macosx_12_0_x86_64.whl | Python 3 | none | macOS 12.0+ x86-64 | Details |
| csvql_query-2.6.2-py3-none-macosx_12_0_arm64.whl | Python 3 | none | macOS 12.0+ ARM64 | Details |
Total release size: 4.0 MB
Release files / csvql_query-2.6.2-py3-none-win_amd64.whl
| Download URL | csvql_query-2.6.2-py3-none-win_amd64.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2cbd9abd328f2e33d968ed83c743f40a5855d746a368ffd2697eb4d7449f20c3
|
|
BLAKE2b-256 checksum How to use checksums |
65cd9cffab657bf710bc64e415a70d02a2ed06bd05ab6b5cceca849010987759
|
| 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.6.2-py3-none-manylinux_2_17_x86_64.whl
| Download URL | csvql_query-2.6.2-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
88cbfb41cb136b677db047454562ca1c7d4657fd034613dbbbd5ddf82d124b2e
|
|
BLAKE2b-256 checksum How to use checksums |
7a8fbad3422a65297732874e3dbfb9ebb7ea3c03113a786b3138d71f6bb031df
|
| 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.6.2-py3-none-manylinux_2_17_aarch64.whl
| Download URL | csvql_query-2.6.2-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
92ee006054c82fafe33c9fc5b0c8c3a20757528c3faaba85a119296b41bd2bd6
|
|
BLAKE2b-256 checksum How to use checksums |
4a8892eac97f909d5a398fec12a1f372877a86b3d579970df01028e7a68fea03
|
| 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.6.2-py3-none-macosx_12_0_x86_64.whl
| Download URL | csvql_query-2.6.2-py3-none-macosx_12_0_x86_64.whl |
|---|---|
| Size | 354.9 kB |
| Tags | Python 3 macOS 12.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
c5ef47e0f227ac576401f0abeb77fc862e3e4c150c239c079440e3a4dbc07d72
|
|
BLAKE2b-256 checksum How to use checksums |
b0162c97b4ce813fc59f984a39eb1ccf37c1f2a1370fba4d483c43478579d7fe
|
| 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.6.2-py3-none-macosx_12_0_arm64.whl
| Download URL | csvql_query-2.6.2-py3-none-macosx_12_0_arm64.whl |
|---|---|
| Size | 354.9 kB |
| Tags | Python 3 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
66b6310cada092934bfb9a1d468737eb224cedb0153a5d2ebac32d537bf1985d
|
|
BLAKE2b-256 checksum How to use checksums |
9ef295ed0637e3f98ad4247e0156a07f2c704bcebebbc508935e19b2a98c6e4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|