Help › Connect to databases
Connect to Apache Cassandra
Connect to Apache Cassandra or ScyllaDB with a user and password, or to DataStax Astra with its secure connect bundle, choose a consistency level, and what is particular to Cassandra.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
Querlyn talks to Apache Cassandra with Cassandra's own protocol, through the same routes as any other database: directly, through SSH, Kubernetes or AWS Systems Manager. Each keyspace is listed in the sidebar with its tables, materialized views, types and functions. Queries are written in CQL, Cassandra's query language; see Query Cassandra. ScyllaDB, which speaks the same protocol, is recognized and connects the same way. DataStax Astra connects with its secure connect bundle; see Connect to DataStax Astra.
What you need
- Apache Cassandra 2.2 or later (Cassandra 4.0 or later for Show Definition and Server Activity), or ScyllaDB.
- The host name of one node of the cluster. Querlyn sends every query to that node, which passes it to the replicas that hold the data.
- A user and password, when the cluster asks for them
(
PasswordAuthenticator). A cluster without authentication needs neither.
Fill in the dialog
- Choose and, under
Database engine, Apache Cassandra, or ScyllaDB right under
it for a ScyllaDB cluster; Querlyn also recognizes it when it
connects. Or copy a
jdbc:cassandra://URL (DataGrip's, for example) and use : it fills in everything below except the password. - Host and Port (9042) name one node. Other contact points
names more, tried in order when the first does not answer, such as
node2.example.com, node3.example.com:9042. - Keyspace is the keyspace query tabs start in. Empty means none:
name each table with its keyspace, as in
shop.orders, or writeUSE shopin the editor. - Fill in User and choose where the password is kept; see Choose where passwords are kept. For a cluster that asks for no login (Cassandra's default), leave User empty.
- Optionally:
- Client certificate: a PEM file holding a certificate and its private key, not encrypted, for nodes that require client certificates. Querlyn reads it at each connect and keeps only its path.
- Consistency: how many replicas answer each read and acknowledge each write. New tabs start with it; each tab can choose another (see below). It is a list of the nine levels; LOCAL_QUORUM is the default.
- Serial consistency: the level of the Paxos round of conditional
writes (
IF NOT EXISTS,IF …): SERIAL or LOCAL_SERIAL.
- Choose Test Connection, then Save & Connect. The result names the node, the cluster, its data center and rack, and the consistency level.
TLS works as for other databases; see
Encrypt a connection. A node set up with
client_encryption_options speaks TLS on the same port. A node that
requires client certificates (require_client_auth) ends the connection
right after the TLS handshake when none, or one it does not trust, is
offered; Querlyn then says so and points at Client certificate.
Connect to DataStax Astra
An Astra database is reached with the zip Astra calls its secure connect bundle, and an application token.
- In the Astra console, open the database's Connect page, download its secure connect bundle, and create an application token.
- In Querlyn, choose and Apache Cassandra.
- Under Secure connect bundle, choose the zip. Querlyn reads the database's address from it and fills in Host and Port, and sets TLS to Verify full. Other contact points and Client certificate are not used.
- Leave User empty (Astra's user for a token is
token) and put the application token, which starts withAstraCS:, in the field now called Application token. It is kept where you choose, by default in the Keychain; see Choose where passwords are kept. - Choose Test Connection, then Save & Connect.
At each connect Querlyn reads the bundle again: the address, the database's own certificate authority and the client certificate in it. Nothing is unpacked and nothing of it is copied elsewhere; Querlyn keeps only the zip's path, so the file has to stay where it is. Querlyn then asks Astra's metadata service where the database's proxy is, and opens the connection through it. Both are verified against the bundle's authority and nothing else. A file that is not a bundle is refused with the reason.
A database Astra has hibernated answers with no contact points: resume it in the Astra console. After Astra rotates a database's certificates, download the bundle again.
Querlyn's support for Astra follows DataStax's documentation and was tried against a stand-in for Astra's servers, not against Astra itself; see Known limits.
Choose a consistency level
The query toolbar of a Cassandra tab shows Consistency with the tab's
level. Choose another from it for this tab only: its reads and writes use
it from then on, and so does every session the tab opens later. Typing
CONSISTENCY QUORUM in the editor, as in cqlsh, does the same, and the
toolbar follows.
A level the cluster cannot meet, such as ALL while a replica is down, fails with the replicas needed and alive; choose a lower level for the tab.
Read rows in the results
- Rows are read a page at a time, 500 by default, as you scroll; a
table of millions of rows is never read at once. Exporting every row of
a
SELECTreads the remaining pages. - Numbers keep every digit.
varintanddecimalare exact; afloatshows as it was written,0.1, not0.10000000149011612. - Timestamps are shown in UTC (
+00), dates over Cassandra's whole range, and times to the nanosecond. Adurationis written as CQL writes it, such as1y2mo3d4h, so a copied value pastes back. - Lists, sets, maps, tuples, user-defined types and vectors show as JSON in one cell: lists, sets, tuples and vectors as arrays, maps and types as objects. Value above the grid shows a long one in full.
- Warnings the node sends, such as a batch that spans too many partitions, are shown under Messages.
What is particular to Cassandra
- The sidebar lists the keyspaces your user may see, each with its
replication (
NetworkTopologyStrategy: dc1 3), system keyspaces last. A table's columns say which are its partition key, which its clustering columns (↓for a descending one) and which are static; its Properties show the whole key, the default time to live and the compaction. Indexes lists its secondary indexes. Opening a table's data runsSELECT * FROM keyspace.tablein a new query tab. - A tab's keyspace is chosen with the database button above the
editor, or with
USEin the editor. - There are no transactions. Every statement takes effect when it runs: there is no Commit or Roll Back, and no Dry Run. A batch applies its statements together.
- A schema change waits for the cluster. After a
CREATE,ALTERorDROP, Querlyn waits until the cluster's nodes hold the same schema, up to 10 seconds, so that the next statement of a script finds the table on every node. When they do not agree in time, for example because a node is down, Messages says so and the script goes on. - When the node goes away, the statement that finds it gone fails with the reason. The next run opens a new session: with the same node if it answers, else with the first of Other contact points that does.
- Editing rows in the results works on a
SELECTof one table that includes its whole primary key. A change is written asUPDATE … IF EXISTS, so a row deleted in the meantime is not written back; a new row asINSERT … IF NOT EXISTS, so it never overwrites one with the same key. Key columns can be typed only in new rows, and lists, sets, maps, types, counters and durations are changed with a statement in the editor. Each change is applied on its own: if one fails, the ones before it stay. See Edit rows in a result. - Cancel stops waiting for a statement. Cassandra has no way to stop a query once it reached the node, so the node finishes it on its own; the tab can run the next one at once.
- Explain runs a
SELECTwith tracing and shows the trace: each node the request touched, with its steps and the time each took. Tombstones read are pointed out. Because the read really happens, a Production connection asks before Explain runs it. Writes are not run by Explain: writeTRACING ONin the editor, and each statement's trace follows its result. See See a query's execution plan. - Server Activity lists the clients connected to the node this connection talks to (Cassandra 4.0 or later, and ScyllaDB): their address, user and driver. Cassandra says nothing of what they run, and a client's query or connection cannot be ended from Querlyn. See See what runs on the server.
- Show Definition on a table, a materialized view, a type, a function
or an aggregate shows its
CREATEstatement, asDESCRIBEwrites it (Cassandra 4.0 or later). - Confirmations are in Cassandra's words: dropping a keyspace or a
table,
TRUNCATE,ALTER TABLE … DROP, and aDELETEof a whole partition or a range of rows ask first on Testing, Staging and Production. See Query Cassandra and Confirm risky statements. - Read-only is Querlyn's check. It refuses writes and schema changes
before they are sent. A role with only
SELECTpermissions is the stronger guard. - Completion offers keyspaces, tables, the columns of the table a
statement is about (its partition key first in a
WHERE), functions, types and CQL's keywords.
What Querlyn does not do
- Send each query to the replicas that hold its data, as Cassandra's own drivers do. One node coordinates every query, which also works through a single SSH tunnel.
- Sign in with Kerberos or LDAP (DataStax Enterprise).
- Run cqlsh's
COPY,SOURCEandCAPTURE: use Export results to write rows to a file. - Explain Analyze, Dry Run, the table designer, Show DDL, ER diagrams, schema compare, Compare Data, copying tables, importing files, profiling a whole table, running on several connections, query parameters, formatting and refactoring: they are written for SQL. Each says so when you choose it.
- Users and roles: run
LIST ROLESandLIST ALL PERMISSIONSin a query tab. - Backup and restore: use
nodetool snapshoton each node. - Lock and statement timeouts, the "blocking others" notice and migration lock warnings: Cassandra's schema changes take no locks.
Help for Querlyn 0.1.0. All help topics