-1
我有一个复杂的JSON我想推入Cassandra,我将有问题和选项mapping.how我应该在Cassandra中设计我的表吗?我的表架构应该是什么?我有一个复杂的json我想推入cassandra
insert into questions_options JSON'{
"qid": "12736467",
"chapter_id": "12",
"subject_id": 19482065,
"topic_id": 216.28,
"type": "picked",
"content": "on time",
"difficulty": 1,
"marks": 12,
"hint": "do something",
"explanations": "do something dude",
"created_by": 1232,
"create_on": "2013-06-10",
"options": [
{
"option_id": 1,
"option_text": "ACBD",
"sort_order": 1,
"correct_option": true
},
{
"option_id": 2,
"option_text": "bcdd",
"sort_order": 2,
"correct_option": true
}
]
}'
我写了下面的创建表query.Is是正确的吗?
create table questions_options (
qid bigint,
chapter_id bigint,
subject_id int,
topic_id int,
class varchar,
type varchar,
content text,
difficulty tinyint,
marks int,
hint text,
explanations text,
created_by bigint,
create_on timestamp,
option_id bigint,
option_text text,
sort_order int,
correct_option boolean,
PRIMARY KEY((qid), option_id)
);
在卡桑德拉你要设计你的表要查询的方式。 –
可以请你给我创建表查询?正如在上面的JSON中,它是一对多的映射,我想把它放在一个表中。 – sam