Skip to content

CQL (Cassandra/ScyllaDB) support in Data Studio: parser gates and grid limitations #217

Closed

Description

@Blankll

Tracking issue for the CQL-specific work in Data Studio / MCP, split into what already landed in #214 and what remains.

Landed in #214 (a4863e4)

sqlparser has no Cassandra dialect, so two independent gates rejected every CQL-specific construct (PER PARTITION LIMIT, ALLOW FILTERING, USING TTL, token(...) ranges) with sql parser error:

Gate Call site Fix
MCP/AI risk classification capabilities/sql_write.rs::classify_sql CQL short-circuits to a keyword classifier (SELECT→Read, INSERT/UPDATE→Write, DELETE/TRUNCATE→Delete, CREATE/ALTER/DROP→Ddl, else Other) plus a literal- and comment-aware multi-statement scan. Ambiguous scripts classify as Other, so a destructive statement can never ride a read-only grant.
Data Studio grid wrapper database/sql_service.rs::wrap_query CQL passes through unparsed. A grid sort/filter/paging request returns an explicit CQL-semantics error instead of a parser failure.

Root cause that made both fixes unreachable: adapter_db_type() returned "generic" for every JdbcBridge connection. It now reads the adapter's real type via the new DatabaseType::slug() — this also fixed dialect selection for all other JDBC engines (ClickHouse, Hive, Databricks, …) that were being classified under GenericDialect.

Covered by tests: keyword buckets, leading comments, semicolons inside string literals ('a;b', '' escapes), trailing comments, and destructive multi-statement tails.

Remaining work

1. Grid affordances for CQL tables

The Data Studio table grid exposes column sort / filter / pagination, none of which translate faithfully to CQL:

  • ORDER BY is legal only on clustering keys, in the table's declared clustering order
  • there is no OFFSET
  • filtering non-key columns requires ALLOW FILTERING (a full scan) or a secondary index

Today these requests return a clear error. Options worth considering: hide the sort/filter controls for CQL connections, or derive a valid ORDER BY from system_schema.columns.kind when the requested column is a clustering key.

2. CQL statement awareness in editor tooling

Completion, the AI permission chain and any sqlparser-backed highlighting still treat CQL as generic SQL. Splitting statements on ; inside the editor is likewise unaware of CQL literals.

3. Secondary-index visibility

list_indexes returns [] for CQL because the wrapper's DatabaseMetaData does not expose system_schema.indexes. A direct system_schema query (the same approach used for tables/columns) would surface user-created indexes such as users_city_idx.

4. Upstream wrapper gaps worth reporting to ing-bank

Verification used

Live Cassandra 4.1.12 and ScyllaDB via the event-search bastion stack, plus a tunnel_test keyspace with 46 users, 1157 hourly metric rows, 137 orders and 24 static-column rows. Query matrix exercised through both the desktop app and the MCP bridge.

Activity

  1. Blankll commented on Nov 18, 2026

    @Blankll
    MemberAuthor

    Migrating to geek-fun/data-studio-agent#39 — the CQL gaps that live in the framework (SqlDatabase whitelist → fixed by geek-fun/data-studio-agent#38, grid affordances, editor awareness, secondary-index visibility) belong to the agent-framework repo where the capability model is defined. sqlkit-side fixes from this tracking (system_schema metadata, CQL risk classification, FK/views empty lists) are in #214.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions