将数据插入 Cassandra 时出错
Getting error while inserting data into Cassandra
我正在尝试将数据插入我的 cassandra 数据库 table,但是我一直收到错误消息,无法找出确切的问题。
这是我的table架构
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));
和我的查询
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”}]");```
这是您的查询的工作版本;
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"}]');
我将 assignment_time
从双引号更改为单引号,您的 user_ids
查询中有 “
- 我也修复了它。
如果您要保留 json 格式的列,我建议您阅读 Cassandra collections
我正在尝试将数据插入我的 cassandra 数据库 table,但是我一直收到错误消息,无法找出确切的问题。
这是我的table架构
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));
和我的查询
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”}]");```
这是您的查询的工作版本;
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"}]');
我将 assignment_time
从双引号更改为单引号,您的 user_ids
查询中有 “
- 我也修复了它。
如果您要保留 json 格式的列,我建议您阅读 Cassandra collections