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 2.10.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 2.10.0
File Actions
csvql_query-2.10.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for csvql_query-2.10.0-py3-none-win_amd64.whl
csvql_query-2.10.0-py3-none-manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for csvql_query-2.10.0-py3-none-manylinux_2_17_x86_64.whl
csvql_query-2.10.0-py3-none-manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for csvql_query-2.10.0-py3-none-manylinux_2_17_aarch64.whl
csvql_query-2.10.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for csvql_query-2.10.0-py3-none-macosx_12_0_x86_64.whl
csvql_query-2.10.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for csvql_query-2.10.0-py3-none-macosx_12_0_arm64.whl

Total release size: 4.9 MB

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

Download URL csvql_query-2.10.0-py3-none-win_amd64.whl
Size 552.0 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
3934306afb0eb19d592244b4cc4390aca263571c5dd3cbd4fa4917aa14c210cb
BLAKE2b-256 checksum
How to use checksums
13459beae6fa6da4e212db355ab4e0d35b2e9d365ce499158f483cb9d8ce012d
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-2.10.0-py3-none-manylinux_2_17_x86_64.whl

Download URL csvql_query-2.10.0-py3-none-manylinux_2_17_x86_64.whl
Size 1.9 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
34f11f4d9bb9c44b4e79e4803f30389d992134d4b339407bddee32974c29a805
BLAKE2b-256 checksum
How to use checksums
6cf1061556d68bbe8fd97420f90c8b50ee9625081ade25fa4040c3f660dd8554
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-2.10.0-py3-none-manylinux_2_17_aarch64.whl

Download URL csvql_query-2.10.0-py3-none-manylinux_2_17_aarch64.whl
Size 1.6 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
634f5b8bac7a6b16c5ab371be175b65494cef605a8c422008b2be7c30c9e98b8
BLAKE2b-256 checksum
How to use checksums
3139481d97d2bbad1021fc97a192a75ad1c47a4f0a66856acdf85a230b084090
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-2.10.0-py3-none-macosx_12_0_x86_64.whl

Download URL csvql_query-2.10.0-py3-none-macosx_12_0_x86_64.whl
Size 387.0 kB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
036233771940920514e5476c18f3c496d34628755e110b64df6f46db8d8d32bf
BLAKE2b-256 checksum
How to use checksums
1e9824d4ba9ca6c2a056c127c2acec6e7053a8c513fefcface8214f3799c32b8
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-2.10.0-py3-none-macosx_12_0_arm64.whl

Download URL csvql_query-2.10.0-py3-none-macosx_12_0_arm64.whl
Size 387.0 kB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
35390794a77ea867f7ff4e0dabad921ab2ef9907a5189eff571121d11b03e49f
BLAKE2b-256 checksum
How to use checksums
e4f2d17709837a2a62660201f06960b241c44fff5ff5fbe6645b8af0a04439f3
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 2.10.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

2.10.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