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

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

Total release size: 5.5 MB

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

Download URL csvql_query-3.0.2-py3-none-win_amd64.whl
Size 609.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
cb2ec755dfe2a908136655b12b976bed66e64560176eb4dcf5fb579fe5346627
BLAKE2b-256 checksum
How to use checksums
d29824998cd4364d4c057b06c2ddbff17cefac1fa79bcc08d38d87216741df67
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.2-py3-none-manylinux_2_17_x86_64.whl

Download URL csvql_query-3.0.2-py3-none-manylinux_2_17_x86_64.whl
Size 2.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
33e1b2bdb34f2e37d4039997be87a14082512feafe36d31fecd5912a5cd7b3b5
BLAKE2b-256 checksum
How to use checksums
08897bebf506ff43d6c4c83a4d2bd049d07a20f00c957512c6db5f0b7cb75d60
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.2-py3-none-manylinux_2_17_aarch64.whl

Download URL csvql_query-3.0.2-py3-none-manylinux_2_17_aarch64.whl
Size 1.8 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c6a39bb64219283c0d12490e699c923205b1bc6ef7dc37787220adf2df98994b
BLAKE2b-256 checksum
How to use checksums
8a9d2b9d459dc595624628510597daf2685e46b001f122514d8aade37dd5104d
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.2-py3-none-macosx_12_0_x86_64.whl

Download URL csvql_query-3.0.2-py3-none-macosx_12_0_x86_64.whl
Size 440.9 kB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
d16a592f0a83dd8d489704e8f7830443a7bd558bf53abedca13f2d9b1beeddb0
BLAKE2b-256 checksum
How to use checksums
9f2242d04ac2869981f82d86af1ebb826378af01bc4fb8c3c869db5d4cdce401
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.2-py3-none-macosx_12_0_arm64.whl

Download URL csvql_query-3.0.2-py3-none-macosx_12_0_arm64.whl
Size 440.9 kB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
41c09db87e7e9e14718a3508d93e1d394149ddc3faed2828be848eef9009fd0f
BLAKE2b-256 checksum
How to use checksums
57b137d833dbe56b380901b79a777620fba6b1925ef74dc340e45b34f100a85b
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.2

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