[英]Getting error while inserting data into Cassandra
I am trying to insert data into my cassandra db table, however I keep getting error and not able to figure out the exact problem.我正在尝试将数据插入到我的 cassandra 数据库表中,但是我不断收到错误并且无法找出确切的问题。
This is my table schema这是我的表架构
CREATE TABLE discoveryassignment.connector_assignments (
connector_id text,
assignment_time timestamp,
connector_type text,
org_id uuid,
user_ids text,
PRIMARY KEY (connector_id, assignment_time));
and my query和我的查询
Insert into discoveryassignment.connector_assignments(connector_id,assignment_time,connector_type,org_id,user_ids) values('f1b987df-2dfbd-437b-bda8-ff459e016f86',"2020-04-24 11:07:37+0000",'migrated',584cf4cd-eea7-4c8c-83ee-67d88fc6ccc5,"[{“userId":"ca38a547-4de4-26ab-bacb-5de9e7449958","fusionType":"calendar"},{"userId":"09d8f28e-2cab-4ce0-9941-34db1de2b000","fusionType":"calendar”}]");```
Here is the working version of your query;这是您查询的工作版本;
insert into discoveryassignment.connector_assignments(connector_id, assignment_time, connector_type, org_id, user_ids)
values ('f1b987df-2dfbd-437b-bda8-ff459e016f86', '2020-04-24 11:07:37+0000', 'migrated', 584cf4cd-eea7-4c8c-83ee-67d88fc6ccc5,
'[{"userId":"ca38a547-4de4-26ab-bacb-5de9e7449958","fusionType":"calendar"},{"userId":"09d8f28e-2cab-4ce0-9941-34db1de2b000","fusionType":"calendar"}]');
i changed assignment_time
from double quotes to single ones, you had “
in your user_ids
query - i fixed that too.我将
assignment_time
从双引号更改为单引号,您的user_ids
查询中有“
- 我也修复了这个问题。
If you are going to keep a json formatted column, i recommend you to read Cassandra collections如果您要保留 json 格式的列,我建议您阅读Cassandra collections
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.