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

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

Total release size: 5.5 MB

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

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

Download URL csvql_query-3.0.3-py3-none-manylinux_2_17_x86_64.whl
Size 2.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
04d9f86645f525e506e2103531ada01b22a26f6d3a056d6bc6a4d70dee1fcdc4
BLAKE2b-256 checksum
How to use checksums
b84972775771aa3656a779f8c78e0e4c7bf90ed4b63ae77840019a1aafb40824
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.3-py3-none-manylinux_2_17_aarch64.whl

Download URL csvql_query-3.0.3-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
e3f9b9795e13b7e00032a7007211e966d3ad455ff174a74708f9e0ce19a310b2
BLAKE2b-256 checksum
How to use checksums
f40e513fee32ecedbea044a9fb0cc577dd0b6cae9b24b61f923980aff1f48e27
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.3-py3-none-macosx_12_0_x86_64.whl

Download URL csvql_query-3.0.3-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
879097d7eed140aa58cce66c4b5048f88ce8bd65c89c9c8e5a79d0c66391e9df
BLAKE2b-256 checksum
How to use checksums
b5c4a0bc71c075676e8b92ae3fc6d77c6ec1fcbc0b9524f7aacc9ee6cfd046ff
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.3-py3-none-macosx_12_0_arm64.whl

Download URL csvql_query-3.0.3-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
4c9abac825db154f6c98e04cd42c1887602ef37028b958b0115f6331120c5b42
BLAKE2b-256 checksum
How to use checksums
50073d0acc9423676e1983bec2d287e81a84176fdb0fb9f5157c55b7d2f238ef
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.3

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