Database design 同一Column族中的复合柱和非复合柱?
我在卡桑德拉数据库上做我的第一个项目,我正试着把我的头脑集中在数据建模上。我试图提出一个ColumnFamily定义,它允许我存储一些可以建模的数据(用C#)如下:Database design 同一Column族中的复合柱和非复合柱?,database-design,cassandra,cassandra-2.0,Database Design,Cassandra,Cassandra 2.0,我在卡桑德拉数据库上做我的第一个项目,我正试着把我的头脑集中在数据建模上。我试图提出一个ColumnFamily定义,它允许我存储一些可以建模的数据(用C#)如下: class the_data { public string prop_1; public string prop_2; public Dictionary<string, Dictionary<string, List<string>>> other_data; } p
class the_data
{
public string prop_1;
public string prop_2;
public Dictionary<string, Dictionary<string, List<string>>> other_data;
}
public Dictionary<string, List<string>> other_data;
CREATE TABLE some_data
{
row_key text, <--- row key (partition key?)
prop_1 text, <--- just a normal column (one per row) #1
prop_2 text, <--- just a normal column (one per row) #2
other_data_outer_key text, <--- composite column name part 1
other_data_inner_key text, <--- composite column name part 2
other_data_value text, <--- composite column value
PRIMARY KEY (row_key, other_data_outer_key, other_data_inner_key)
};
然而,我不明白(或者可能不可能)的是,如何拥有复合列(因为其他_data_outer_键和其他_data_inner_键成为列名的一部分),以及其他不是复合列的列,也不是针对每个键组合重复的列
我想要这样的东西:
class the_data
{
public string prop_1;
public string prop_2;
public Dictionary<string, Dictionary<string, List<string>>> other_data;
}
public Dictionary<string, List<string>> other_data;
CREATE TABLE some_data
{
row_key text, <--- row key (partition key?)
prop_1 text, <--- just a normal column (one per row) #1
prop_2 text, <--- just a normal column (one per row) #2
other_data_outer_key text, <--- composite column name part 1
other_data_inner_key text, <--- composite column name part 2
other_data_value text, <--- composite column value
PRIMARY KEY (row_key, other_data_outer_key, other_data_inner_key)
};
创建一些表数据
{
行键文本,查看静态列:
这提供了一种将每个分区的属性存储在具有群集列的表中的方法。完美,正是我想要的。谢谢!