Skip to main content

QQL is a SQL-like query language and CLI for Qdrant vector database. Write INSERT, SEARCH, RECOMMEND, DELETE, and CREATE COLLECTION statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, cross-encoder reranking, quantization (scalar, turbo, binary, product), WHERE clause filters, script execution, and collection dump/restore.

Project description

QQL — Qdrant Query Language

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

PyPI version Python 3.12+ MIT License Tests

Write INSERT, SEARCH, RECOMMEND, DELETE, and CREATE COLLECTION statements instead of Python SDK calls. Supports hybrid dense+sparse vector search, 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) to merge the results of both retrieval methods.


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>

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 / RECOMMEND / Hybrid / RERANK Semantic search, hybrid, reranking, recommendations
WHERE Filters Full SQL-style filter operators
Collections & Quantization CREATE, DROP, QUANTIZE (scalar/turbo/binary/product), CREATE INDEX
Scripts: EXECUTE / DUMP Script files, collection backup/restore
Programmatic Usage Use QQL as a Python library
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 USING HYBRID
SEARCH articles SIMILAR TO 'query' LIMIT 10 USING HYBRID RERANK

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

-- Collections
CREATE COLLECTION articles
CREATE COLLECTION articles HYBRID
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
SHOW COLLECTIONS
DROP COLLECTION articles

-- 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: 375 tests passing.


License

MIT © Kameshwara Pavan Kumar Mantha

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qql_cli-2.1.0.tar.gz (78.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qql_cli-2.1.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file qql_cli-2.1.0.tar.gz.

File metadata

  • Download URL: qql_cli-2.1.0.tar.gz
  • Upload date:
  • Size: 78.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for qql_cli-2.1.0.tar.gz
Algorithm Hash digest
SHA256 9a64b8fa40f7c51d0b57b717e2e51602ad755e7f7ea7d21b109421fc4d8f93e1
MD5 d8615d0e25f1a2b9b7ef39b54799ab8a
BLAKE2b-256 1651d49692f69c09b95c7f9bd010307449b964d50ea12ce45c23e92fe337c938

See more details on using hashes here.

File details

Details for the file qql_cli-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: qql_cli-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for qql_cli-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac8db425d806de19c51b33bff3a1680f7643728ce9327b37df844955061149cd
MD5 770003ccd24dac83ebc04bdf99711cd4
BLAKE2b-256 0919b5750609b096fdae0423932b950c3cf920dcff759b62b3173e923064376f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page