Help › Write SQL
Query Cassandra
Write CQL on Cassandra and ScyllaDB connections: statements and batches, cqlsh's CONSISTENCY and TRACING, completion that knows the partition key, and which statements ask first.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
On a Cassandra connection, the editor takes CQL, the Cassandra Query Language, the way cqlsh and Cassandra's documentation write it:
SELECT device, ts, reading
FROM readings
WHERE device = 7f3e2a10-4c1b-4d2e-9a8f-0b6c5d4e3f21 AND day = '2026-10-08'
LIMIT 50;
CQL looks like SQL but is a language of its own: there are no joins, a
WHERE names a table's partition key, and writes replace what is there.
Querlyn reads it as CQL, never as SQL. Running, cancelling, the results
and the history work as for SQL; see Run statements and scripts.
Write statements
- Statements end at
;. A batch,BEGIN BATCH … APPLY BATCH, is one statement: the;s inside it do not end it, and it runs as one request. - cqlsh's own commands end at the end of their line, with or without
;, so aCONSISTENCY QUORUMline does not swallow the query below it. - Values are CQL's: strings in
'…', blobs as0xCAFE, UUIDs and time UUIDs written bare, durations as1h30m, collections as[…],{…}and{key: value}, and function bodies between$$and$$. - Names are folded to lower case unless written in double quotes, as
"OrderLines". - Comments are
--or//to the end of the line, and/* … */. ⌘/ on macOS or Ctrl+/ on Windows and Linux comments lines with--.
cqlsh's commands
| Write | What it does |
|---|---|
CONSISTENCY | Says the tab's consistency level. |
CONSISTENCY QUORUM | Sets it for this tab, as Consistency in the toolbar does. |
SERIAL CONSISTENCY LOCAL_SERIAL | Sets the level of conditional writes' Paxos round. |
TRACING ON, TRACING OFF | Traces each statement that follows: its trace is shown as a second result, step by step with the node and the microseconds. |
USE shop | A CQL statement: moves the tab to the keyspace. |
DESCRIBE … | A CQL statement on Cassandra 4.0 and later. |
COPY, SOURCE, CAPTURE, LOGIN, SHOW, PAGING and EXPAND are
not run: COPY and CAPTURE say to use Export results,
and the results grid reads pages as you scroll.
Completion
Completion offers what fits where the cursor is: statements at the start,
tables after FROM, INTO, UPDATE and TRUNCATE (views only where a
table is read), the tables of a keyspace after keyspace., keyspaces after
USE, and functions and the table's columns in the select list. In a
WHERE the partition key's columns come first, then the clustering
columns in order; other columns say they need an index or ALLOW FILTERING. SET offers only columns that are not part of the key, and
ORDER BY only clustering columns. Types follow a column's name in
CREATE TABLE, and consistency levels follow CONSISTENCY. See
Complete SQL as you type.
ALLOW FILTERING is underlined with a warning: it reads every partition
the WHERE does not narrow down, across the cluster. On a Production
connection Querlyn also asks before it runs such a statement (see
Safety).
Safety
Querlyn judges each statement before it runs, and each statement of a batch.
- On Testing, Staging and Production, it asks first for statements
that destroy data:
DROP KEYSPACE,DROP TABLE,DROP MATERIALIZED VIEWand the otherDROPs,TRUNCATE,ALTER TABLE … DROP, and aDELETEthat does not name one whole primary key, because it removes a whole partition or a range of rows. ADELETEof one row, or of a row's columns, does not ask.REVOKEasks too: it takes permissions or roles away. - A
GRANTis not checked for what it gives away: Production asks about it. - Whether a
DELETEnames a whole key is judged by the table's key in the sidebar's metadata. When Querlyn has not read that table's key yet, theDELETEis treated as one it cannot judge. - A statement Querlyn cannot read is treated as one that changes data: Production asks, a read-only connection refuses it.
- On Production, a
SELECTwithALLOW FILTERINGasks first. It changes nothing, but it reads every partition theWHEREdoes not narrow down, on every node. Other connections run it with the editor's warning only. - On Production, Explain asks first. Cassandra has no plans to
estimate, so Explain runs the
SELECTwith tracing and reads its first page of rows. - A read-only connection refuses every write and schema change.
- Writes replace what is there. An
INSERTof an existing key overwrites the row, and anUPDATEof a missing one creates it; addIF NOT EXISTSorIF EXISTSto make them conditional.
See Confirm risky statements and Read-only connections.
Help for Querlyn 0.1.0. All help topics