I can create a new SuperColumn that has Columns - no problem. I can create a new Column - no problem. But how do I add a new Column to an existing SuperColumn?
Asked
Active
Viewed 655 times
1 Answers
1
But how do I add a new Column to an existing SuperColumn?
You should really look into the class SuperCfTemplate
and class SuperCfUpdater
in hector. Once they are initialize, do what is needed (example in your question, add a new cf within this scf), then update the changes using the template. Below are a snippet.
SuperCfTemplate<String, String, String> template = new ThriftSuperCfTemplate<String, String, String>(keyspace, "Super1", stringSerializer, stringSerializer, stringSerializer);
SuperCfUpdater<String, String, String> updater = template.createUpdater("key", "newcf");
updater.setString("subname", "1");
template.update(updater);

Jasonw
- 5,054
- 7
- 43
- 48
-
But, if I just want to add the column definition without a key? – Joeya Jun 18 '12 at 19:39
-
@Joeya without a key, how should that row be identified or where should the row store? Please read this [link](http://wiki.apache.org/cassandra/DataModel#Rows) for more information. – Jasonw Jun 19 '12 at 01:39