Skip to content

feat: add SELECT statement for retrieving a point by ID#25

Merged
srimon12 merged 1 commit into
pavanjava:mainfrom
srimon12:feat/retrieve-point-by-id-clean
May 13, 2026
Merged

feat: add SELECT statement for retrieving a point by ID#25
srimon12 merged 1 commit into
pavanjava:mainfrom
srimon12:feat/retrieve-point-by-id-clean

Conversation

@srimon12
Copy link
Copy Markdown
Collaborator

Summary

This PR adds first-class point retrieval by ID to QQL with a strict, minimal SQL-like syntax:

SELECT * FROM <collection> WHERE id = '<point_id>'
SELECT * FROM <collection> WHERE id = <integer_id>

The scope is intentionally narrow for safety and clarity:

  • only * projection is supported
  • only WHERE id = ... is supported

Why

QQL already supports insert/search/recommend/delete, but lacked a direct read-by-ID operation.
Qdrant SDK already provides retrieve(...), so this closes a real CRUD gap with low implementation risk.

Changes

  • Lexer:

    • add SELECT keyword token
    • add * token (STAR)
  • Parser:

    • add SELECT * FROM <collection> WHERE id = <string|integer> statement parsing
    • add strict validation for point-id value type
    • reuse point-id parsing helper for both SELECT and DELETE id paths
  • AST:

    • add SelectStmt(collection, point_id)
  • Executor:

    • execute SelectStmt via QdrantClient.retrieve(...)
    • return payload-only result shape:
      • found: {"id": "<id>", "payload": {...}}
      • not found: success message with data=None
    • raise clear runtime errors for non-existent collections and SDK failures
  • Script runner:

    • include SELECT in top-level statement split starters
  • CLI:

    • add SELECT syntax to help text
    • add pretty-print table for single SELECT result
  • Docs:

    • add SELECT syntax/examples and constraints
    • update reference/error docs from “SELECT unsupported” to supported strict form
    • update quick syntax/programmatic docs
    • update test-count badges/text to current suite total

Tests

Added/updated tests for:

  • lexer tokenization of SELECT and *
  • parser success and strict-scope rejection cases
  • executor behavior:
    • found record
    • not found
    • missing collection
  • script statement splitting with SELECT

Full test run:

  • pytest -q
  • result: 414 passed

@srimon12 srimon12 requested a review from pavanjava May 13, 2026 08:13
srimon12 added a commit to srimon12/qql that referenced this pull request May 13, 2026
@srimon12 srimon12 force-pushed the feat/retrieve-point-by-id-clean branch from 62c119d to ff74eab Compare May 13, 2026 15:40
@srimon12 srimon12 force-pushed the feat/retrieve-point-by-id-clean branch from 559da0b to 644e85b Compare May 13, 2026 15:53
@srimon12 srimon12 merged commit 1708d1c into pavanjava:main May 13, 2026
2 checks passed
@srimon12 srimon12 deleted the feat/retrieve-point-by-id-clean branch May 13, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants