Skip to main content

csvql-query

CI License: MIT PyPI

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)
  • pandas optional — only needed for query_df()

Metadata

Release files for csvql-query 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for csvql-query 3.0.0
File Actions
csvql_query-3.0.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for csvql_query-3.0.0-py3-none-win_amd64.whl
csvql_query-3.0.0-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for csvql_query-3.0.0-py3-none-manylinux_2_17_x86_64.whl
csvql_query-3.0.0-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for csvql_query-3.0.0-py3-none-manylinux_2_17_aarch64.whl
csvql_query-3.0.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for csvql_query-3.0.0-py3-none-macosx_12_0_x86_64.whl
csvql_query-3.0.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for csvql_query-3.0.0-py3-none-macosx_12_0_arm64.whl

Total release size: 5.1 MB

Release files / csvql_query-3.0.0-py3-none-win_amd64.whl

Download URL csvql_query-3.0.0-py3-none-win_amd64.whl
Size 578.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
caf7f7f7eea2d96ae0476b76f295b4fa2e861a765460e1c6f650e4cbc4e4c96b
BLAKE2b-256 checksum
How to use checksums
4f3b218e2b726ef56b5b6c4158461505d7e1b40c1276debae95984f3aeca5efb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / csvql_query-3.0.0-py3-none-manylinux_2_17_x86_64.whl

Download URL csvql_query-3.0.0-py3-none-manylinux_2_17_x86_64.whl
Size 2.0 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7f1dd4347dbb0228d6b47ad4299e78a9116366cc32c70305a0d975be31c0cfb6
BLAKE2b-256 checksum
How to use checksums
f68b977d5d724b621151fac09a7329c8a359f16938c23b8ff9cae4a797e1cdec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / csvql_query-3.0.0-py3-none-manylinux_2_17_aarch64.whl

Download URL csvql_query-3.0.0-py3-none-manylinux_2_17_aarch64.whl
Size 1.7 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
5a5cf9634d5104c7142cce003a0a7ffd941870e54c62482b94efb57b37ff9a39
BLAKE2b-256 checksum
How to use checksums
b46648cca837bcd808e3d539d3a99693aa02d4eb4598fd82120574ca6d15286d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / csvql_query-3.0.0-py3-none-macosx_12_0_x86_64.whl

Download URL csvql_query-3.0.0-py3-none-macosx_12_0_x86_64.whl
Size 410.5 kB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
32b963c2c9cf9ce58617a51a920c9f9c554fdd7b128f332f177a258001d87d64
BLAKE2b-256 checksum
How to use checksums
9cf60ad6634e1f0324c7f5118e782318f9d9ad12a9c81e982df94b02418d6cfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / csvql_query-3.0.0-py3-none-macosx_12_0_arm64.whl

Download URL csvql_query-3.0.0-py3-none-macosx_12_0_arm64.whl
Size 410.5 kB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
84c5a52c80e8b8e0cee89768528f5f782e8ba976b80d43f341601f6f5283ded7
BLAKE2b-256 checksum
How to use checksums
2b3b38440f9208e3b7d875b94bbf20dba61ad8add590db6f35963538227fb9cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for csvql-query 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.0.0 This release

5 release files No provenance

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