CQL shell (cqlsh) reference

Commands specific to the Cassandra Query Language shell (cqlsh) utility.

In cqlsh, type help to list all available topics. Type help name to find out more about the name command. For example help CAPTURE or help ALTER_KEYSPACE.

The CQL shell commands described in this section work only within the cqlsh shell and are not accessible from drivers. CQL shell uses native protocol and the DataStax Python Driver to execute CQL commands on the connected host. For configuration information, see the cassandra.yaml file.


cqlsh (startup options)

Describes the options for starting the CQL shell.

Configuring a cqlshrc file

A cqlshrc file contains CQL shell session settings that are used when the CQL shell starts.

CAPTURE

Appends CQL query results to a file.

CLEAR

Clears the CQL shell terminal window.

CONSISTENCY

Determines how many nodes in the replica must respond for the coordinator node to successfully process a non-lightweight transaction (non-LWT) during the CQL shell session.

COPY TO

Exports data from a table to a CSV file.

COPY FROM

Imports data from a CSV file into a table.

DESCRIBE AGGREGATE

Lists all user-defined aggregates (UDAs) or shows the CQL definition for a specific UDA.

DESCRIBE CLUSTER

Shows high-level details about the connected cluster.

DESCRIBE SCHEMA

Shows definitions for all objects in the cluster.

DESCRIBE FUNCTION

Shows information on user-defined functions (UDFs).

DESCRIBE INDEX

Shows the definition of a specified index.

DESCRIBE KEYSPACE

Shows a list of all keyspaces in the cluster or definition of each object in a specified keyspace.

DESCRIBE MATERIALIZED VIEW

Shows the definition of the specified materialized view.

DESCRIBE SEARCH INDEX

Shows the definition of specified search index in XML format.

DESCRIBE TABLE

Shows a list of all tables in a keyspace, or executable CQL information for a single table.

DESCRIBE TYPE

Lists user-defined types (UDTs) in the current keyspace, or all UDTs in the cluster when no keyspace is selected, or the CQL definition for a specified UDT.

EXECUTE AS

Provides a testing mechanism when setting up proxy roles by running CQL commands as another role.

EXPAND

Formats query output vertically.

EXIT

Terminates the CQL shell.

LOGIN

Switches the user account without ending the CQL shell session.

PAGING

Shows query results in 100-line groups.

SERIAL CONSISTENCY

Sets the serial consistency for a lightweight transaction (LWT).

SHOW

Shows the software version, current session node, and tracing session details.

SOURCE

Executes a file containing CQL statements.

TIMING

Enables or disables simple request round-trip timing, as measured on the current CQL shell session.

TRACING

Enables or disables request tracing for all CQL statements in the current CQLSH session.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com