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.
Go to data tab > there you will see all keyspcaces created by you and some system keyspaces. You can see all tables under individual keyspaces and also replicator factor for keyspace.
If you need to know informaiton about table or tables you can use Nodetool cfstats command. Syntax: If you will only provide the name of keyspace, it will provide stats for all the tables in that keyspace.
$describe = new Cassandra\SimpleStatement(<<<EOD describe keyspace. tablename EOD ); $session->execute($describe);
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:
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.
It can also be done with DevCenter and OpsCenter.
DevCenter: Find the table in Schema -> right click -> clone table. You can find CQL Preview at the button of the window.
OpsCenter: Cluster -> Data -> Table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With