|CQL reference / cqlsh commands|
Provides information about the connected Cassandra cluster, or about the data objects stored in the cluster.
DESCRIBE CLUSTER | SCHEMA | KEYSPACES | KEYSPACE keyspace_name | TABLES | TABLE table_name
In the synopsis section of each statement, formatting has the following meaning:
A semicolon that terminates CQL statements is not included in the synopsis.
The DESCRIBE or DESC command outputs information about the connected Cassandra cluster, or about the data stored on it. To query the system tables directly, use SELECT.
The keyspace and table name arguments are case-sensitive and need to match the upper or lowercase names stored internally. Use the DESCRIBE commands to list objects by their internal names.
DESCRIBE functions in the following ways:
Output is the information about the connected Cassandra cluster, such as the cluster name, and the partitioner and snitch in use. When you are connected to a non-system keyspace, this command also shows endpoint-range ownership information for the Cassandra ring.
Output is a list of CQL commands that could be used to recreate the entire schema. Works as though DESCRIBE KEYSPACE <k> was invoked for each keyspace k.
Output is a list of all keyspace names.
Output is a list of CQL commands that could be used to recreate the given keyspace, and the tables in it. In some cases, as the CQL interface matures, there will be some metadata about a keyspace that is not representable with CQL. That metadata will not be shown.
The <keyspacename> argument can be omitted when using a non-system keyspace; in that case, the current keyspace is described.
Output is a list of the names of all tables in the current keyspace, or in all keyspaces if there is no current keyspace.
Output is a list of CQL commands that could be used to recreate the given table. In some cases, there might be table metadata that is not representable and it is not shown.
DESCRIBE CLUSTER; DESCRIBE KEYSPACES; DESCRIBE KEYSPACE PortfolioDemo; DESCRIBE TABLES; DESCRIBE TABLE Stocks;