cql2
Parse, validate, and convert Common Query Language (CQL2) text and JSON
What it is and what it does
cql2 is a Python binding to a Rust implementation of the OGC Common Query Language (CQL2) standard. It lets you parse CQL2 query expressions from text or files and convert them into multiple output formats—text, JSON, or SQL—making it useful for applications that need to accept user-friendly query syntax and translate it into database-specific query languages.
The package provides both a Python API and a command-line tool. It has no runtime dependencies beyond Python itself, though installation requires pre-built wheels or a Rust toolchain to compile. It supports Python 3.10 through 3.14 and is actively maintained.
Use it for:
- Convert user-supplied CQL2 query strings into SQL for database backends in geospatial or data-discovery applications
- Parse and validate CQL2 expressions in REST APIs that accept OGC-compliant query filters
- Transform CQL2 text queries into JSON representation for downstream processing or storage
- Build CLI tools that accept CQL2 syntax and emit SQL or other query formats
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses, validates, and converts Common Query Language (CQL2) expressions between text, JSON, and SQL formats using a Rust backend.
Yes. The package is actively maintained, has no security vulnerabilities, carries a permissive MIT license, and solves a specific standards-based problem (CQL2 parsing and conversion). Medium install friction is acceptable given the pre-built wheels for common platforms. Install if you need to parse or convert CQL2 expressions; skip if you don't work with OGC query standards.
Install
cql2 on PyPI
pip
pip install cql2uv
uv add cql2poetry
poetry add cql2Installing cql2
Before you install
Medium install friction due to compiled Rust bindings, but pre-built wheels cover common platforms (macOS, Linux, Windows, multiple architectures). Active maintenance with a release within the last day.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install cql2
from cql2 import Expr
expr = Expr("landsat:scene_id = 'LC82030282019133LGN00'")
print(expr.to_sql())
Requires Python 3.10 or later; compiled wheels available for common platforms but may require compilation on unsupported architectures.
Verify before relying
- Whether the CLI is automatically available after pip install or requires additional setup
- Performance characteristics for large or complex CQL2 expressions
- Completeness of CQL2 standard coverage in this implementation
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 121,001/month — #12,001 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cql2-0.6.0-cp310-abi3-macosx_10_12_x86_64.whl; cql2-0.6.0-cp310-abi3-macosx_11_0_arm64.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl; cql2-0.6.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; cql2-0.6.0-cp310-abi3-musllinux_1_2_aarch64.whl; cql2-0.6.0-cp310-abi3-musllinux_1_2_armv7l.whl; cql2-0.6.0-cp310-abi3-musllinux_1_2_i686.whl; cql2-0.6.0-cp310-abi3-musllinux_1_2_x86_64.whl; cql2-0.6.0-cp310-abi3-win32.whl; cql2-0.6.0-cp310-abi3-win_amd64.whl
Keywords: cql2
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
hogql-parser-rsParses HogQL query expressions into JSON AST…
permissive · top 5,000 on PyPI
scim2-filter-parserParses SCIM 2.0 filter query strings into…
permissive · top 5,000 on PyPI
pygeofilterParses OGC filtering standards (CQL, CQL JSON,…
permissive · top 15,000 on PyPI
syntaqliteParse, format, validate, and tokenize SQLite…
permissive · top 15,000 on PyPI
promql-parserParses Prometheus query language (PromQL)…
unclear · top 15,000 on PyPI
jsonata-pythonEvaluates JSONata expressions against JSON…
permissive · top 5,000 on PyPI
moz-sql-parserParses SQL queries into JSON-serializable parse…
copyleft · top 15,000 on PyPI
sqloxidesqloxide parses SQL queries into a typed…
permissive · top 15,000 on PyPI
mo-sql-parsingParses SQL queries into JSON-serializable parse…
copyleft · top 15,000 on PyPI
openlineage-sqlProvides a Python interface to a Rust-based SQL…
unclear · top 5,000 on PyPI