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

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

Total release size: 5.5 MB

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

Download URL csvql_query-3.0.4-py3-none-win_amd64.whl
Size 609.4 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
297c444412869c9db7dd55f2f9feb19b35ee488b58a7b587c12d5d513e7cd9a0
BLAKE2b-256 checksum
How to use checksums
dff0b2804f0a4141bdab314fafd1210176000e02404b1140025ee72f5d9c4174
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.4-py3-none-manylinux_2_17_x86_64.whl

Download URL csvql_query-3.0.4-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
aefcdf603d6c917753e2145595f27248b23602df5293458b719cb75d025b1058
BLAKE2b-256 checksum
How to use checksums
b1da1b68c481aff3b19698aa4a48c82bc1060c81f40d94648b10794c9b7ac2e4
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.4-py3-none-manylinux_2_17_aarch64.whl

Download URL csvql_query-3.0.4-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
b72d1c0bcdf407e6698c42f450c17f82871e1901cbf23032a0027cded07e4f44
BLAKE2b-256 checksum
How to use checksums
a13bc16d0937ca39e607e3fecbef54ad7d9d7b44ad3054fd2c2eef0819e0ef6e
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.4-py3-none-macosx_12_0_x86_64.whl

Download URL csvql_query-3.0.4-py3-none-macosx_12_0_x86_64.whl
Size 441.2 kB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
eaf9573b89dfca451e1df5bb680807aa99bc57cbb20c40a74789f3ecd2bf182a
BLAKE2b-256 checksum
How to use checksums
dc06e38ce955c7d8133822871643803964ed0466816aaf1b4bd67e656f387217
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.4-py3-none-macosx_12_0_arm64.whl

Download URL csvql_query-3.0.4-py3-none-macosx_12_0_arm64.whl
Size 441.3 kB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
627590c0ac7981860b22d2c1b277d8a6aae426c2738de9e7a8d8ce96cf563fb9
BLAKE2b-256 checksum
How to use checksums
034a7fbcf151fd85731ab989b2ffb1492d227726df0246f3f1f612ac50133d97
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.4

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