Native Python bindings for the Qdrant Query Language parser and runtime
Project description
pyqql
Native Python bindings for the Qdrant Query Language (QQL) parser, router, and execution engine, compiled with PyO3 0.23.
Features
- Live Qdrant Execution: Connect to live Qdrant instances over REST (default) or gRPC
- Automated Embedding Inference: Integrate custom HTTP embedder models (Ollama, OpenAI, vLLM, TEI) for text-to-vector search
- Zero-Copy Route Lowering: Lower QQL queries to typed
{ method, path, payload }route dicts viacompile_query - Native parsing: Rust-speed QQL parsing in Python returning typed
Stmtobjects or Python dicts - Filter injection: Add tenant isolation filters programmatically
- Smart batching: Auto-batches contiguous same-collection query/mutation statements into single network calls
- Shard key: Read/write the shard key on QUERY, COUNT, SCROLL, UPSERT, and DELETE statements
- Validation: Check if a query string is valid QQL
Compatibility
- Python 3.8+: Published wheels use Python's stable ABI (
abi3-py38) and support Python 3.8 and newer. - REST and gRPC: Published wheels include both transports by default.
Installation
pip install pyqql
Quick Start
import pyqql
# 1. Connect to live Qdrant with optional custom embedding provider (e.g. Ollama)
embedder = pyqql.HttpEmbedder(
endpoint="http://localhost:11434/v1/embeddings",
model="all-minilm:l6-v2",
dimension=384,
api_key=""
)
client = pyqql.Client(
url="http://localhost:6333",
api_key="optional-qdrant-secret",
use_grpc=False,
embedder=embedder
)
# Execute QQL query (auto-embeds text to vector)
result = client.execute("QUERY 'cardiology' FROM medical_records USING dense LIMIT 5")
print(result)
# Async variant
future = client.execute_async("QUERY 'cardiology' FROM medical_records USING dense LIMIT 5")
# Explain query execution plan
plan = client.explain("QUERY 'cardiology' FROM medical_records USING dense LIMIT 5")
print(plan)
# 2. Pure AST Parsing & Filter Injection
stmt = pyqql.parse("QUERY 'vector database' FROM docs USING dense LIMIT 10")[0]
valid = pyqql.is_valid("QUERY 'test' FROM docs")
secured_stmt = pyqql.inject_filter("QUERY 'patients' FROM medical LIMIT 5", "org_id", "=", "acme-corp")
# 3. Working with Stmt objects
ast_dict = stmt.to_dict() # Python dict
ast_json = stmt.to_json() # JSON string
stmt.shard_key = "shard-01" # setter (QUERY/COUNT/SCROLL/UPSERT/DELETE only)
stmt.inject_filter("tenant_id", "=", "acme") # mutate in-place
# 4. Free-function execute (convenience)
result = pyqql.execute("SHOW COLLECTIONS", url="http://localhost:6333")
# 5. Lower to Qdrant route without executing
route = pyqql.compile_query("QUERY 'search' FROM docs LIMIT 10")
# route = { "method": "POST", "path": "/collections/docs/points/query", "payload": {...} }
All execution methods return an ExecutionReport dict:
{"ok": bool, "results": list, "succeeded": int, "failed": int}. The
results list always contains one entry per executed statement.
API Summary
| Export | Description |
|---|---|
Client(url, api_key, use_grpc, embedder) |
Client for executing QQL against a live Qdrant database |
HttpEmbedder(endpoint, model, dimension, api_key) |
First-class HTTP embedding provider configuration |
Stmt |
Parsed statement object with inject_filter(), to_json(), to_dict(), shard_key property |
parse(input) |
Parse one statement or a semicolon-delimited script into a list of Stmt objects |
is_valid(input) |
Validate QQL syntax |
inject_filter(query, field, op, value) |
Inject tenant filter into statement AST (accepts str or Stmt) |
tokenize(input) |
Tokenize QQL string for syntax highlighting or inspection |
compile_query(input) |
Lower QQL statement into typed { method, path, payload } route dict |
explain(query) |
Inspect the execution plan without executing network calls (accepts str or Stmt) |
execute(query, ..., on_error="stop") |
Free-function convenience execute |
execute_async(query, ..., on_error="stop") |
Free-function async execute |
Client.execute(query, on_error="stop") |
Execute a string, Stmt, list[str], or list[Stmt] |
Client.execute_async(query, on_error="stop") |
Async variant of execute |
Client.explain(query) |
Inspect execution plan (accepts str or Stmt) |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqql-0.1.1-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: pyqql-0.1.1-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28edff3e8fc8299e1aeadd9e81a2cba72c9fabeb0c9d6b30a99045a273071421
|
|
| MD5 |
77cee68eb3f0595ed39caab3b2997ddd
|
|
| BLAKE2b-256 |
1f505b6e228980fb16a104dfeed7c63cd1a8bd13e786ebe1991551062f0c50e9
|
Provenance
The following attestation bundles were made for pyqql-0.1.1-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on srimon12/qql-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqql-0.1.1-cp38-abi3-win_amd64.whl -
Subject digest:
28edff3e8fc8299e1aeadd9e81a2cba72c9fabeb0c9d6b30a99045a273071421 - Sigstore transparency entry: 2256795914
- Sigstore integration time:
-
Permalink:
srimon12/qql-rs@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/srimon12
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyqql-0.1.1-cp38-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyqql-0.1.1-cp38-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7449e5a2f71b68df75fcbdef7fa27d096c8cd75406ed62d2973a2c99797cbf04
|
|
| MD5 |
2d7a715286affd7081cdf3e66e43553b
|
|
| BLAKE2b-256 |
94bf0012b58ca32f688ffc652304ccc89df27f72d274f5a33e4900cd8ab83514
|
Provenance
The following attestation bundles were made for pyqql-0.1.1-cp38-abi3-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on srimon12/qql-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqql-0.1.1-cp38-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
7449e5a2f71b68df75fcbdef7fa27d096c8cd75406ed62d2973a2c99797cbf04 - Sigstore transparency entry: 2256795919
- Sigstore integration time:
-
Permalink:
srimon12/qql-rs@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/srimon12
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyqql-0.1.1-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyqql-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
306371a972ad24651a89f21bbae2b15e4f5a58337ff2e4b83f120a1b0e5f7f84
|
|
| MD5 |
bc37505a6b41259db445a96510c1d8a2
|
|
| BLAKE2b-256 |
e5b85ce93d21717d98e337203a760c1a22c7126e69dbbdba6cbc25937c26e245
|
Provenance
The following attestation bundles were made for pyqql-0.1.1-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on srimon12/qql-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqql-0.1.1-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
306371a972ad24651a89f21bbae2b15e4f5a58337ff2e4b83f120a1b0e5f7f84 - Sigstore transparency entry: 2256795927
- Sigstore integration time:
-
Permalink:
srimon12/qql-rs@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/srimon12
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyqql-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyqql-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19a3191f6cff659f47b66883c4b4ca71d53fca28a82c81aa2630a87ec35d5f8a
|
|
| MD5 |
c19e5a1389f91e598a5fe78a769ece24
|
|
| BLAKE2b-256 |
80a7ef4e784ad355daad366a53380002a4747d340b24c6308d7b2e062dc42f13
|
Provenance
The following attestation bundles were made for pyqql-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on srimon12/qql-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyqql-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
19a3191f6cff659f47b66883c4b4ca71d53fca28a82c81aa2630a87ec35d5f8a - Sigstore transparency entry: 2256795907
- Sigstore integration time:
-
Permalink:
srimon12/qql-rs@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/srimon12
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@518d299ed166c6e636df95f65621f6fb49ff21b3 -
Trigger Event:
push
-
Statement type: