Is there a way to discover Cassandra CQL table structure?

cassandra, cql

Solution

You should try the `cqlsh` tool which will show you exactly what you want:

lyubent@vm: ~$ ./cqlsh 
cqlsh> use system;
cqlsh> describe columnfamily local;

CREATE TABLE local (
  key text PRIMARY KEY,
  bootstrapped text,
  cluster_name text,
  cql_version text,
  data_center text,
  gossip_generation int,
  host_id uuid,
  partitioner text,
  rack text,
  release_version text,
  schema_version uuid,
  thrift_version text,
  tokens set<text>,
  truncated_at map<uuid, blob>
) WITH
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='information about the local node' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=0 AND
  read_repair_chance=0.000000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};

EDIT Although great at the time the blog i linked is ood. To run cqlsh in windows:

- first install python 2.7.x (not python 3!) download

- Add python to your path (as a new environment variable)

Run the setup by navigating to `C:\dir\to\cassandra\pylib` in a cmd prompt and executing the below line:

python setup.py install

GZ. Now you have cqlsh on windows.

Problem

Let's say I use CQL to define this table. ``` CREATE TABLE songs ( id uuid PRIMARY KEY, title text, album text, artist text, tags set<text>, data blob); ``` How can other developers (or myself after a few weeks) (re)discover the layout of this table? I'm thinking of an equivalent to the MySQL `DESCRIBE {tablename}` command. [EDIT] I see there is a `DESCRIBE` method in Cassandra's command line interface (CLI), but upon using it, it states that it doesn't include information on CQL tables in its results.

Original source