How to dynamically add columns to a column family in cassandra using cql

I want to dynamically add columns to this column family using cql code.

CREATE COLUMN FAMILY blog_entry WITH comparator = UTF8Type AND key_validation_class=UTF8Type AND default_validation_class = UTF8Type; 

How can I do it?

+6
source share
3 answers

This becomes a bit of a FAQ, so I wrote a detailed explanation: http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows

+14
source

To do this, you first need to modify the table to add a column, and then insert will start working. I tried above on cqlsh and it worked.

 alter table newdata add column name varchar; 

See also the link below:

How to define dynamic column families in cassandra

+3
source
 ALTER TABLE blog_entry ADD newcolumnname text; 
0
source

Source: https://habr.com/ru/post/946584/


All Articles