Question

I defined a table in cql3. Describing it returns the following:

CREATE TABLE results (
id uuid PRIMARY KEY,
casename text,
result text,
run int,
user text
) WITH ...

I try to use the fact that this is should not limit the columnfamily and add a new column-value pair:

insert into results (id, sogginess) values(3d6f63a4-c1e0-4dd8-b043-8e0754122f23, 'high') ;

But this doesn't work. IF I use cassandra-cli, I can add the value of sogginess with the standars set syntax and the row is persisted normally. Even though, switching back to cql3, the select * query does not return this new column and neither describe shows the new column sogginess.

This means that you can't add arbitrary data to the rows in cql3 and you're bound by the schema defined? If not, how can I do it?

Was it helpful?

Solution

TL;DR;
No, but you can use collections: phonenumbers set<text>

CQL 3 expects all columns to be defined in the metadata, so yes you are bound to a schema.

If not, how can I do it?

Well, you cant. What you can do is use collections and structure your data model. Adding arbitrary columns via thrift is considered to be bad practice. My advice is read datastax's article on wide row support in CQL3. Also these questions are related (if not duplicate...) so take a look at them:

  1. Does cql3 require a schema for cassandra now
  2. Create a table in Cassandra 1.2 with CQL3 where column names will be created at runtime
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top