Cassandra Query Language (CQL) for Astra DB
Because Astra DB is powered by Apache Cassandra®, you can send Cassandra Query Language (CQL) statements to your Astra DB Serverless databases with the CQL shell (cqlsh), Cassandra drivers, or the Data API.
To use CQL for Astra DB, you need an active Astra DB Serverless database with a keyspace. Familiarity with CQL is helpful but not required.
For more information about CQL for Astra DB, including command examples and specifications, see the CQL for Astra DB reference.
Limitations on CQL for Astra DB
To ensure high availability and optimum performance, Astra DB Serverless databases have guardrails on underlying Cassandra functionality, including commands and functionality available through CQL for Astra DB.
Keyspace, table, and column names are case sensitive
If you create a table in the Astra Portal, the table name, keyspace name, and column names become case-sensitive. Make sure your CQL commands use case sensitivity for these values. For more information, see How do I fix a "table does not exist" error in CQL.
Unsupported values are ignored
If you pass a CQL statement with unsupported data definition language (DDL) properties, the statement is executed without the unsupported values. Astra DB ignores the unsupported values and throws a warning.
For example, the following command creates a table with the given schema, and it attempts to pass an additional nodesync property:
CREATE TABLE IF NOT EXISTS library.books
(
id UUID PRIMARY KEY,
lastname text,
firstname text)
WITH nodesync={'enabled': 'true'};
If you execute this statement against an Astra DB database, the table is created but the nodesync property is ignored.
The response includes a warning with the ignored unsupported values:
Warnings :
Ignoring provided values [nodesync] as they are not supported for Table
Properties(ignored values are: [additional_write_policy,
bloom_filter_fp_chance, caching, cdc, compaction, compression,
crc_check_chance, dse_edge_label_property, dse_vertex_label_property,
gc_grace_seconds, id, max_index_interval, memtable,
memtable_flush_period_in_ms, min_index_interval, nodesync, read_repair,
speculative_retry])
Limited support for user-defined objects
CQL for Astra DB supports user-defined type (UDTs). It doesn’t support user-defined functions (UDFs) or user-defined aggregate functions (UDAs).
Unsupported CQL commands
|
For all supported CQL commands, see the CQL for Astra DB quick reference. |
CQL for Astra DB doesn’t support the following commands:
| Category | Unsupported commands | Notes |
|---|---|---|
Access control |
|
For information access control in Astra, see Roles and permissions reference. |
Keyspaces |
|
The CQL shell For information about keyspaces in Astra, see Manage keyspaces. |
Materialized views (MV) |
|
|
Triggers |
|
|
User-defined aggregates (UDA) |
|
Astra DB supports user-defined types (UDT) only. |
User-defined functions (UDF) |
|
Astra DB supports UDT only. |
DSE Search indexes |
|
Execute CQL statements
To run CQL statements against your Astra DB Serverless databases, you can use the CQL shell, a Cassandra driver, or the Data API.
- Data API and clients
-
You can use the Data API and clients to manage tables in Astra DB Serverless databases, including tables you previously created with
cqlshor a driver. For more information, see Get started with the Data API (HTTP) and About tables with the Data API (HTTP). - Drivers
-
Astra DB Serverless databases are compatible with the following Cassandra drivers:
Supported drivers Language Driver source Documentation C++
C#
Go
gocql-astra (includes cassandra-gocql-driver)
Java
Node.js
Python
Scala
For more information, see Cassandra driver compatibility.
- CQL shell (cqlsh)
-
The CQL shell is a command-line utility that you can use to interact with your Astra DB Serverless databases using CQL. For more information, see Connect to the CQL shell for Astra DB.