qql_intercept.py wraps the qdrant-client Python SDK at the HTTP layer, captures all REST API calls, and converts them to QQL using qql-go convert. Use it to migrate existing Python code to QQL.
uv venv .venv && source .venv/bin/activate uv pip install qdrant-clientpython3 sdks/python/qql_intercept.py your_script.pypython3 sdks/python/qql_intercept.py your_script.py -o output.qqlExample
Section titled “Example”Given ingest.py:
from qdrant_client import QdrantClientfrom qdrant_client.models import PointStruct
client = QdrantClient("localhost", port=6333)client.upsert( collection_name="docs", points=[ PointStruct(id=1, payload={"text": "hello"}, vector=[0.1, 0.2, 0.3]), PointStruct(id=2, payload={"text": "world"}, vector=[0.4, 0.5, 0.6]), ])client.search("docs", query_vector=[0.1, 0.2, 0.3], limit=5)Running the interceptor:
python3 sdks/python/qql_intercept.py ingest.py -o output.qqlProduces output.qql:
INSERT INTO docs VALUES {'id': 1, 'text': 'hello', 'vector': {'': [0.1, 0.2, 0.3]}}INSERT INTO docs VALUES {'id': 2, 'text': 'world', 'vector': {'': [0.4, 0.5, 0.6]}}QUERY [0.1, 0.2, 0.3] FROM docs LIMIT 5Supported Operations
Section titled “Supported Operations”The interceptor captures any operation that QdrantClient makes via HTTP:
upsert→INSERT INTO ... VALUESsearch/query_points→QUERY ... FROMrecommend→QUERY RECOMMEND WITH (...)scroll→SCROLL FROMretrieve→SELECT * FROM ... WHERE id = ...delete→DELETE FROM ... WHEREcreate_collection→CREATE COLLECTIONcreate_payload_index→CREATE INDEX ONset_payload→UPDATE ... SET PAYLOAD
Workflow
Section titled “Workflow”Step 1: Intercept and convertSection titled “Step 1: Intercept and convert”python3 sdks/python/qql_intercept.py ingest.py -o output.qqlStep 2: Validate the outputSection titled “Step 2: Validate the output”qql-go convert --validate output.qqlStep 3: Review and adjust as neededSection titled “Step 3: Review and adjust as needed”Step 4: Execute with qql-goSection titled “Step 4: Execute with qql-go”qql-go execute output.qql