Keyspace, table, and column information

Querying system.schema_* tables directly to get keyspace, table, and column information.

An alternative to the cqlsh describe_* functions or using DevCenter to discover keyspace, table, and column information is querying system.schema_* table directly.

Procedure

  • Query the defined keyspaces using the SELECT statement.
     SELECT * FROM system.schema_keyspaces;


  • Query schema_columnfamilies about a particular table.
     SELECT * FROM system.schema_columnfamilies WHERE keyspace_name = 'cycling' AND columnfamily_name = 'cyclist_name';
  • Query schema_columns about the columns in a table.
     SELECT * FROM system.schema_columns WHERE keyspace_name = 'cycling' AND columnfamily_name = 'cyclist_name';