【发布时间】:2016-09-05 05:15:20
【问题描述】:
如何在 cassandra 中插入这样的内容:
{
"custID" : '12736467',
"date" : '2013-06-10',
"orderID" : 19482065,
"amount" : 216.28,
"items" : [
{ "id" : 1
"sku" : 87482734,
"quantity" : 4
},
{ "id":2
"sku" : 32851042,
"quantity" : 2
}
]
}
我认为在 cassandra 中存储这些数据的最佳方法是创建一个包含 family 列的表:
custId | date | orderID | amount | items
id | sku | quantity
12736467 2013-06-10 19482065 216.28 1 87482734 4
2 32851042 2
create table items {
id text,
sku int,
quantity int};
create table test {
custId text,
date bigint,
orderId text,
amount float,
items list<items >,
PRIMARY KEY ((custId))
};
但是如何在每次不使用更新的情况下插入此表(插入测试...)。
【问题讨论】: