Python library and command-line interface (CLI) for parsing and converting Common Query Language (CQL2), with Rust under the hood.
pip install cql2Then:
expr = Expr("landsat:scene_id = 'LC82030282019133LGN00'")
# or
expr = cql2.parse_file("fixtures/text/example01.txt")
s = expr.to_text()
d = expr.to_json()
sql = expr.to_sql()
print("SQL query:", sql.query)
print("SQL params:", sql.params)Or from via the command-line interface:
$ cql2 -o json "landsat:scene_id = 'LC82030282019133LGN00'"
{"op":"=","args":[{"property":"landsat:scene_id"},"LC82030282019133LGN00"]}To install the package to your virtual environment and test:
maturin develop --uv -m python/Cargo.toml && pytest pythonThis package is part of cql2-rs, see that repo for license and contributing information.