Skip to content

feat: Apache Cassandra - #29

Merged
FabioHAraujo merged 1 commit into
mainfrom
feat/cassandra
Oct 30, 2026
Merged

FabioHAraujo merged 1 commit into
mainfrom
feat/cassandra

Conversation

@Richards0nd

@Richards0nd Richards0nd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

LowQuery has no way to connect to Apache Cassandra. CQL is not SQL (no joins, no transactions, keyspaces instead of schemas, collections and UDTs as column values), so it needs its own driver and conventions, as Redis got.

Behavior

Cassandra is a new connection type, on the scylla native driver (MIT OR Apache-2.0, TLS through rustls, no OpenSSL). It speaks the CQL native protocol to Apache Cassandra 3.x, 4.x and 5.x.

  • Connection: one or more contact points (comma separated), port 9042, optional user and password (password in the OS keychain, like the other engines), default keyspace, local datacenter, TLS disable/prefer/require/verify-full. The status bar shows Apache Cassandra <release_version>.
  • Values: exact CQL text. varint and decimal keep every digit, floats are shortest round-trip, timestamp/date/time/duration, uuid/timeuuid, inet, blobs as 0x…, counters, and collections, tuples, UDTs and Cassandra 5 vectors as valid CQL literals (a cell can be pasted back into an INSERT).
  • Row limit: applied with paging (page size from the limit, reading stops at max_rows + 1).
  • No transactions: autocommit only. The Autocommit/Commit/Rollback controls are hidden. BEGIN BATCH … APPLY BATCH runs as one statement.
  • Cancel: CQL has no server-side cancel, so Cancel stops waiting for the answer (documented in ARCHITECTURE.md).
  • Warnings: server warnings (for example aggregations without a partition key) appear as messages, like PostgreSQL notices.
  • Schema browser: from system_schema (plus system_virtual_schema on 4.0+): keyspaces (system ones last) → tables, materialized views, types, functions, aggregates, indexes → columns with partition/clustering/static markers. Show DDL builds CREATE statements from the catalog (DESCRIBE is a cqlsh command, not part of the protocol).
  • Editor: CQL mode (CodeMirror Cassandra dialect), script splitting for ;, '' and "" quoting, $$ bodies, --, // and /* */ comments, and batches. CQL identifier quoting and SELECT * FROM ks.tbl LIMIT n previews; tree actions and DDL templates that exist in CQL.
  • Result editing: a single-table SELECT that includes the whole primary key is editable; changes are sent as one logged batch (UPDATE … WHERE <pk>, DELETE FROM … WHERE <pk>, INSERT). Otherwise the grid shows why it is read-only (missing key columns, alias, counters, views, system tables).
  • Export/import: SQL (CQL literals per type, one INSERT per row, counters as UPDATE c = c + n), CSV and JSON. Imports run one INSERT at a time with no transaction (documented).
  • AI agents (MCP): CQL-aware guard (read = SELECT/LIST; one statement per call, batches count as one; USE refused), catalog search and describe_table with key roles.
  • Import of connections: DBeaver and DataGrip Cassandra connections (jdbc:cassandra:) are mapped.
  • JSON import fix (found by the round-trip test): numbers in a JSON file are no longer parsed through f64, so values beyond 17 digits (varint, NUMERIC, BIGINT) keep every digit for all engines.
  • CI job with Cassandra 4.1 and 5.0 service containers (health check on cqlsh), docs, changelog (Unreleased), README, issue template. No version bump.

How it was verified

Against real servers in Docker, cassandra:5.0 (5.0.9) and cassandra:4.1, with LQ_CASSANDRA_HOST/PORT:

cargo test --lib cassandra -- --ignored --test-threads=1

7 passed on each version: types, limits, errors and warnings, schema/DDL round trip and streaming, result editing, ddl fixtures, cancel, MCP end-to-end (mcp_cassandra_server) and the export/import round trip (SQL, CSV, CSV for Excel, JSON).

Also checked by hand: password authentication (PasswordAuthenticator: login works, bad and missing credentials report an authentication error and ask for the password) and TLS against a server with client_encryption_options (prefer and require connect, disable is refused by the server, verify-full rejects an unknown issuer). Those two were one-off checks, not part of the test suite.

Local checks (all pass):

  • bun install --frozen-lockfile, bun run check (0 errors, 0 warnings), bun test (99 pass), bun run build
  • cargo fmt --check, cargo clippy --lib --tests -- -D warnings, cargo test --locked --lib (212 passed, 74 ignored)
  • UI smoke test on the bun run dev mock: Cassandra appears in the engine picker with its fields, the tree lists keyspaces, and a Cassandra tab has no commit controls.

Not run

  • Cassandra 3.x (the code branches for its table options, but no 3.x server was tested), Cassandra 5.1+ and DataStax Enterprise/Astra.
  • A real Tauri build against a live server (bun run tauri dev): only the Rust integration tests and the browser mock were exercised.
  • cargo deny (not installed locally); the new dependencies are MIT/Apache-2.0/BSD-3-Clause.
  • Oracle, SQL Server, MySQL, MariaDB, PostgreSQL, Redis integration tests (no servers here); their code only changed by a new DbColumn.key_role field and the JSON import parser.
  • UDF/aggregate scripting needs user_defined_functions_enabled; the test skips it when the server has it off.

Known limitations

  • Cancel only stops waiting; the coordinator keeps working until its own timeout.
  • Result metadata does not say which collections/UDTs are frozen, so a result column type shows list<int> where the table says frozen<list<int>>.
  • verify-full checks the certificate chain, expiry and signatures but not the host name, because the driver connects to the addresses the cluster reports.
  • UPDATE/DELETE never report a missing row (CQL writes are upserts); primary-key columns cannot be edited in place (delete and insert).
  • Importing a JSON object into a collection column is not supported (CSV, and exported cells, are CQL literals).

Adds Apache Cassandra (CQL) as a connection type, on the `scylla` native
driver with TLS through rustls. Works with Cassandra 3.x, 4.x and 5.x.

- Driver: contact points, port, optional user and password (keychain),
  default keyspace, local datacenter and TLS modes; server version from
  system.local; row limits through paging; server warnings as messages;
  Cancel stops waiting (CQL has no server-side cancel); no transactions.
- Exact values: varint and decimal keep every digit, timestamp, date, time,
  duration, uuid, inet, blobs as hex, and collections, tuples, UDTs and
  Cassandra 5 vectors as CQL literals.
- Schema browser from system_schema: keyspaces, tables, materialized views,
  types, functions, aggregates and indexes, with partition, clustering and
  static column markers. Show DDL builds CREATE statements from the catalog.
- Grid editing for single-table SELECTs that include the whole primary key,
  saved as one logged batch.
- Interface: engine picker, connection dialog, CQL editor mode with
  BEGIN BATCH ... APPLY BATCH as one statement, script splitting, identifier
  quoting, tree actions and DDL templates, no commit controls.
- Export to SQL, CSV and JSON and import from CSV and JSON, MCP tools with a
  CQL statement classifier, DBeaver and DataGrip connection import.
- JSON import keeps numbers exact (no rounding beyond 17 digits).
- CI runs Cassandra 4.1 and 5.0 integration tests.
@FabioHAraujo
FabioHAraujo merged commit eef0e69 into main Oct 30, 2026
19 checks passed
@FabioHAraujo FabioHAraujo mentioned this pull request Oct 30, 2026
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