Commenting Cassandra's keyspace, table, column

2.8k Views Asked by At

In Oracle there is possibility to add a comment about a table, view, materialized view, or column into the data dictionary, e.g.

COMMENT ON COLUMN employees.job_id 
   IS 'abbreviated job title';

I found this particularly usefull as a tester when trying to understand ideas behind the names which are not necessarily self-explanable and in large databases (over 200 tables).

Is there such feature in Cassandra?

1

There are 1 best solutions below

4
On BEST ANSWER

You can use 'with comment' option

cqlsh:d2> 
cqlsh:d2> create table employee (id int primary key, name text) with comment = 'Employee id and name';
cqlsh:d2> desc table employee;

CREATE TABLE d2.employee (
    id int PRIMARY KEY,
    name text
) WITH bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = 'Employee id and name'
    AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

Cassandra documentation