Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

cassandra

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

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

how shall I do it?

like image 667
Shalu Avatar asked Jun 05 '13 11:06

Shalu


2 Answers

This is becoming something of a FAQ, so I wrote an in-depth explanation: http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows

like image 173
jbellis Avatar answered Nov 06 '22 19:11

jbellis


For this to work you have to first alter the table to add column and then insert will start working. I tried the above on cqlsh and it worked.

alter table newdata add column name varchar;

Please refer below link too:

How to define dynamic column families in cassandra

like image 24
Harish Kumar Avatar answered Nov 06 '22 19:11

Harish Kumar