DESCRIBE

更新时间:
复制 MD 格式

The DESCRIBE command prints the DDL statements for schema objects in Lindorm Cassandra Query Language (CQL). Use these statements to inspect the structure of keyspaces, tables, and indexes, or to recreate them in another environment.

Lindorm CQL supports the following DESCRIBE variants:

VariantDescription
DESCRIBE KEYSPACESLists the names of all keyspaces
DESCRIBE KEYSPACE [keyspace_name]Shows the DDL of a keyspace and all schema objects it contains
DESCRIBE TABLESLists the names of all tables in a specified keyspace
DESCRIBE TABLE [keyspace_name.] table_nameShows the DDL of a table
DESCRIBE INDEX [keyspace_name.] index_nameShows the DDL of an index

DESCRIBE KEYSPACES

Lists the names of all keyspaces.

Syntax

DESCRIBE KEYSPACES

Output fields

FieldTypeDescription
keyspace_nametextThe name of the keyspace.
nametextThe name of the schema object.

Example

DESCRIBE KEYSPACES;

DESCRIBE KEYSPACE

Shows the DDL of a keyspace and all schema objects it contains. Schema objects include tables, user-defined types (UDTs), and user-defined functions (UDFs).

Syntax

DESCRIBE KEYSPACE [keyspace_name]
If keyspace_name is omitted, the command returns schema objects in the current keyspace. If keyspace_name is specified, the command returns schema objects in that keyspace.

Parameters

ParameterTypeDescription
keyspace_nametextThe name of the keyspace.

Output fields

FieldTypeDescription
nametextThe name of the schema object.
create_statementtextThe Lindorm CQL statement used to recreate the schema object.

Example

DESCRIBE KEYSPACE testks;

DESCRIBE TABLES

Lists the names of all tables in a specified keyspace. If the specified keyspace does not exist, the command lists all keyspaces instead.

Syntax

DESCRIBE TABLES

Output fields

FieldTypeDescription
keyspace_nametextThe name of the keyspace.
nametextThe name of the schema object.

Example

DESCRIBE TABLES

DESCRIBE TABLE

Shows the DDL of a table as a Lindorm CQL statement that can be used to recreate the table.

Syntax

DESCRIBE TABLE [keyspace_name.] table_name

Parameters

ParameterTypeDescription
keyspace_nametextThe name of the keyspace. Optional. If omitted, the current keyspace is used.
table_nametextThe name of the table.

Output fields

FieldTypeDescription
nametextThe name of the schema object.
create_statementtextThe Lindorm CQL statement used to recreate the table.

Example

DESCRIBE TABLE persioninfo;

DESCRIBE INDEX

Shows the DDL of a table index as a Lindorm CQL statement that can be used to recreate the index.

Syntax

DESCRIBE INDEX [keyspace_name.] index_name

Parameters

ParameterTypeDescription
keyspace_nametextThe name of the keyspace. Optional. If omitted, the current keyspace is used.
index_nametextThe name of the index.

Output fields

FieldTypeDescription
nametextThe name of the schema object.
create_statementtextThe Lindorm CQL statement used to recreate the index.

Example

DESCRIBE INDEX testks.myindex;