CQL: Invalid set literal for values of type map
Asked Answered
Q

2

7

I have this table

create table constants_values
              (
               key_name_1 text,
               key_name_2 text,
               values map<text, frozen<nav_tag_values>>,
               PRIMARY KEY(key_name_1, key_name_2)
              );

UDT:

 CREATE TYPE ks_mobApp.nav_tag_values (
               values set<text>
              );

Here i am inserting values:

cqlsh:ks_mobapp> insert into constants_values(key_name_1,key_name_2,values) 
values('Sell', 'Electronics', {{'Mobile', {values:{'Laptop'}}}});

and here is error:

InvalidRequest: code=2200 [Invalid query] 
message="Invalid set literal for values of type map<text, nav_tag_values>"

What i am missing ?

Quipster answered 17/1, 2016 at 13:21 Comment(0)
R
4

Try this with cqlsh:

INSERT INTO constants_values(key_name_1,key_name_2,values) 
VALUES('Sell', 'Electronics', {'Mobile': {value : ['Laptop']});
Response answered 17/1, 2016 at 13:54 Comment(1)
query is correct except ['Laptop'] should be {'Laptop'}Quipster
K
1
INSERT INTO constants_values(key_name_1,key_name_2,values)  values('Sell', 'Electronics', {'Mobile': {values:{'Laptop'}}});

the key point is the : vs the , in your original statement.

Kansu answered 1/6, 2016 at 13:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.