I'm trying to model a column family in Cassandra 1.1 which logically looks like this:
Entp: //CF
//rowkey-> entp_name_xyz:
{entp_full_name: "full_name_xyz",
some_value: 1,
policy: {policy_name: "default policy",
type: "type 1",
prop_1: "prop 1",
...
},
rules: {rule_1:, rule_2:,rule_3:}
}
The queries I'm trying to model are: Get all policies given an entp name, Get all rules given an entp, Get all columns given an entp_name I'm planning to model this column family as having "wide rows" where one row would look like this:
RowKey:- entp_name_xyz,
column_name:- policy:p1
Value:-{JSON object - {policy_name: "default policy", type: "type 1", prop_1: "prop 1", ...}}
column_name:- policy:p2
Value:-{JSON object - {policy_name: "default policy2", type: "type 1", prop_1: "prop 1", ...}}
column_name: rule:r1 where r1 is a rowkey of a Rules column family
Value: Null
Now my question is in cqlsh or cassandra-cli,
- how do I insert a composite column name such as policy:p1?
- With this scheme, is it possible to have a query like: select * from entp where column_name like "policy:*" and entp_name= xyz in order to just read all the policy columns ?
How do I set a null value for a column. I read in some forums that you shouldn't need to set a null because its equivalent to not having a value. But consider the case where you have a static schema with col1, col2 and col3 and I want to insert a row with col3 =null, but with col1 and col2 having some values. What is the cqlsh syntax to insert such data (I could not find it in the documentation) because the following gives an error:
insert into entp (col1,col2,col3) values ("abc","xyz", null)
Thanks!