使用CQL fromJson函数时使用什么JSON格式?
我正在使用Cassandra的CQL fromJson函数,并插入以下内容:使用CQL fromJson函数时使用什么JSON格式?,json,cassandra,cql,Json,Cassandra,Cql,我正在使用Cassandra的CQL fromJson函数,并插入以下内容: INSERT INTO promotions.promotion (id, siteid, clientid, type, name, code, description, created, duestart, dueend, status, resolution, typespec, currencies ) VALUES ( uuid(), 100000, 100000, 'FS', 'One', 'O
INSERT INTO promotions.promotion (id, siteid, clientid, type, name, code, description, created,
duestart, dueend, status, resolution, typespec, currencies
)
VALUES (
uuid(), 100000, 100000, 'FS', 'One', 'ONE', 'One description',
dateof(now()), dateof(now()), dateof(now()), 'WAITING', 'UNRESOLVED', { 'spins':'10' },
fromJson('{
"currencyId" : "123",
"currencyCode" : "GBP",
"currencyGames" : [{
"gameConfigId" : 123,
"typeSpec" : { "numSpins" : 10, "dummy" : "yes" }
}]
}')
);
当我在DevCenter或cqlsh中运行此命令时,会出现以下错误:
我对卡桑德拉有点初级,只是在学习它的潜力,但这让我感到困惑。我尝试过不同的括号组合,但没有效果。我一定在做傻事
模式如下:
CREATE TYPE promotions.promotion_currency_game (
gameConfigId bigint,
typeSpec MAP<text,text>
);
CREATE TYPE promotions.promotion_currency (
currencyId bigint,
currencyCode text,
currencyGames set<FROZEN<promotion_currency_game>>
);
CREATE TABLE promotions.promotion (
id uuid,
siteid bigint,
clientid bigint,
type text,
name text,
code text,
description text,
created timestamp,
duestart timestamp,
dueend timestamp,
status text,
resolution text,
typespec MAP<text,text>,
currencies SET<FROZEN<promotion_currency>>,
PRIMARY KEY (id)
) WITH compression = {
'class' : 'LZ4Compressor',
'enabled' : true
};
创建类型促销。促销\u货币\u游戏(
GameConfidBigint,
类型规格图
);
创建类型促销。促销\u货币(
currencyId bigint,
货币代码文本,
currencyGames集
);
创建表促销。促销(
id uuid,
siteid bigint,
clientid bigint,
键入文本,
名称文本,
代码文本,
说明文字,
创建时间戳,
开始时间戳,
双端时间戳,
状态文本,
决议案文,
类型规格图,
货币设定,
主键(id)
)压缩时={
“类”:“LZ4压缩机”,
“已启用”:true
};
您能为表升级包含架构定义吗?升级?现在工作,但我回家后会发布。@Kango_V您能发布此架构吗?添加了架构。抱歉耽搁了。当圣诞节妨碍了我的编程时,真烦人;)