pavanjava
qql
Python

SQL-like query language and CLI for Qdrant vector search engine

Last updated Jun 13, 2026
46
Stars
4
Forks
0
Issues
0
Stars/day
Attention Score
49
Language breakdown
Python 100.0%
โ–ธ Files click to expand
README

QQL โ€” Qdrant Query Language

SQL-like query language and CLI for Qdrant vector database.

PyPI version Python 3.12+ MIT License Tests

Write INSERT, SELECT, SEARCH, SCROLL, RECOMMEND, UPDATE, DELETE, and CREATE COLLECTION statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, grouped search (GROUP BY), cross-encoder reranking, quantization (scalar, turbo, binary, product), SQL-style WHERE filters, script execution, and collection dump/restore.

qql> INSERT INTO COLLECTION notes VALUES {'text': 'Qdrant is a vector database', 'author': 'alice', 'year': 2024}
โœ“ Inserted 1 point [3f2e1a4b-8c91-4d0e-b123-abc123def456]

qql> SEARCH notes SIMILAR TO 'vector storage engines' LIMIT 3 WHERE year >= 2023 โœ“ Found 1 result(s) Score โ”‚ ID โ”‚ Payload โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 0.8931 โ”‚ 3f2e1a4b-8c91-4d0e-b123-abc123def456 โ”‚ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}

qql> SEARCH notes SIMILAR TO 'vector databases' LIMIT 5 USING HYBRID RERANK โœ“ Found 1 result(s) (hybrid, reranked) Score โ”‚ ID โ”‚ Payload โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 5.3754 โ”‚ 3f2e1a4b-8c91-4d0e-b123-abc123def456 โ”‚ {'text': 'Qdrant is a ...', 'author': 'alice', 'year': 2024}


How It Works

QQL is a thin translation layer between a SQL-like query language and the Qdrant Python client. Every statement you type goes through three stages:

Your query string
      โ”‚
      โ–ผ
  [ Lexer ]      โ€” tokenizes the input into keywords, identifiers, literals
      โ”‚
      โ–ผ
  [ Parser ]     โ€” builds a typed AST node (e.g. InsertStmt, SearchStmt)
      โ”‚
      โ–ผ
  [ Executor ]   โ€” maps the AST node to a Qdrant client call
      โ”‚
      โ–ผ
  Qdrant instance

When you run INSERT, the text field is automatically converted into a dense vector using Fastembed. In hybrid mode (USING HYBRID), a sparse BM25 vector is also generated alongside the dense vector, and searches use Qdrant's Reciprocal Rank Fusion (RRF) by default to merge the results of both retrieval methods. You can switch hybrid search to DBSF with FUSION 'dbsf'.

QQL also exposes a programmatic API for use inside Python applications โ€” no CLI required:

from qql import Connection

with Connection("http://localhost:6333") as conn: conn.run_query("INSERT INTO COLLECTION notes VALUES {'text': 'Qdrant is fast'}") result = conn.run_query("SEARCH notes SIMILAR TO 'vector database' LIMIT 5") for hit in result.data: print(hit["score"], hit["payload"])


Installation

Requirements: Python 3.12+, a running Qdrant instance.

pip install qql-cli

Connect to a Qdrant instance:

# Local
qql connect --url http://localhost:6333

Qdrant Cloud

qql connect --url https://<your-cluster>.qdrant.io --secret <your-api-key>

Internal/self-signed certificate

qql connect --url https://<your-host>:6333 --secret <your-api-key> --ca-cert /path/to/ca.pem

Disable TLS verification when you cannot provide a CA bundle

qql connect --url https://<your-host>:6333 --secret <your-api-key> --no-verify

Then type qql to open the interactive shell.


Documentation

Full documentation lives in the docs/ folder and at pavanjava.github.io/qql:

| Topic | Description | |---|---| | Getting Started | Installation, connecting, first queries | | INSERT / INSERT BULK | Adding documents, batch inserts, payload types | | SEARCH / SELECT / SCROLL / RECOMMEND / Hybrid / GROUP BY / RERANK | Semantic search, grouped search, point retrieval, pagination, hybrid, reranking, recommendations | | WHERE Filters | Full SQL-style filter operators | | Collections & Quantization | SHOW, CREATE, DROP, QUANTIZE (scalar/turbo/binary/product), CREATE INDEX, UPDATE VECTOR, UPDATE PAYLOAD | | Scripts: EXECUTE / DUMP | Script files, collection backup/restore | | Programmatic Usage | Use QQL as a Python library via Connection or runquery() | | Reference: Models / Config / Errors | Embedding models, config file, error reference |


Quick Syntax Reference

-- Insert
INSERT INTO COLLECTION articles VALUES {'text': '...', 'year': 2024}
INSERT BULK INTO COLLECTION articles VALUES [{'text': '...'}, {'text': '...'}]

-- Search SEARCH articles SIMILAR TO 'query' LIMIT 10 SEARCH articles SIMILAR TO 'query' LIMIT 10 WHERE year >= 2020 SEARCH articles SIMILAR TO 'query' LIMIT 10 WHERE active = true SEARCH articles SIMILAR TO 'query' LIMIT 10 WITH { mmrdiversity: 0.5, mmrcandidates: 50 } SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID FUSION 'dbsf' SEARCH articles SIMILAR TO 'query' LIMIT 10 WITH { indexed_only: true } SEARCH articles SIMILAR TO 'query' LIMIT 10 WITH { quantization: { ignore: true, oversampling: 2 } } SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID RERANK

-- Scroll SCROLL FROM articles LIMIT 50 SCROLL FROM articles WHERE year >= 2024 LIMIT 50 SCROLL FROM articles AFTER 'cursor-id' LIMIT 50

-- Recommend RECOMMEND FROM articles POSITIVE IDS (1001, 1002) LIMIT 5

-- Select (retrieve a point by ID) SELECT * FROM articles WHERE id = '3f2e1a4b-...'

-- Collections CREATE COLLECTION articles CREATE COLLECTION articles HYBRID CREATE COLLECTION articles WITH HNSW { payload_m: 16 } CREATE COLLECTION articles WITH VECTORS { ondisk: true } WITH HNSW { fullscan_threshold: 10000 } ALTER COLLECTION articles WITH OPTIMIZERS { indexing_threshold: 10000 } ALTER COLLECTION articles WITH PARAMS { readfanoutfactor: 4, ondisk_payload: false } ALTER COLLECTION articles QUANTIZE DISABLED CREATE COLLECTION articles QUANTIZE SCALAR CREATE COLLECTION articles QUANTIZE TURBO CREATE COLLECTION articles QUANTIZE TURBO BITS 2 CREATE COLLECTION articles QUANTIZE TURBO BITS 1.5 ALWAYS RAM CREATE INDEX ON COLLECTION articles FOR year TYPE integer CREATE INDEX ON COLLECTION articles FOR tenantid TYPE keyword WITH { istenant: true, on_disk: true } CREATE INDEX ON COLLECTION articles FOR doc_id TYPE uuid CREATE INDEX ON COLLECTION articles FOR title TYPE text WITH { tokenizer: 'word', mintokenlen: 2, lowercase: true } SHOW COLLECTIONS SHOW COLLECTION articles DROP COLLECTION articles

-- Search with grouping SEARCH articles SIMILAR TO 'query' LIMIT 5 GROUP BY category SEARCH articles SIMILAR TO 'query' LIMIT 5 GROUP BY category GROUP_SIZE 3 SEARCH articles SIMILAR TO 'query' LIMIT 5 WHERE year >= 2020 GROUP BY category GROUP_SIZE 2 SEARCH articles SIMILAR TO 'query' LIMIT 5 USING HYBRID GROUP BY category

-- Update UPDATE articles SET VECTOR WHERE id = '3f2e1a4b-...' [0.1, 0.2, 0.3, 0.4] UPDATE articles SET PAYLOAD WHERE id = '3f2e1a4b-...' {'year': 2025, 'status': 'active'} UPDATE articles SET PAYLOAD WHERE category = 'draft' {'status': 'published'}

-- Delete DELETE FROM articles WHERE id = '3f2e1a4b-...' DELETE FROM articles WHERE year < 2020

-- Scripts EXECUTE /path/to/script.qql DUMP articles /path/to/backup.qql


Running Tests

Tests do not require a running Qdrant instance โ€” the Qdrant client is mocked.

pytest tests/ -v

Expected: 549 tests passing.


License

MIT ยฉ Kameshwara Pavan Kumar Mantha

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท pavanjava/qql ยท Updated daily from GitHub