Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CQL: Invalid set literal for values of type map

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 ?

like image 287
Manish Kumar Avatar asked Jan 17 '16 13:01

Manish Kumar


2 Answers

Try this with cqlsh:

INSERT INTO constants_values(key_name_1,key_name_2,values) 
VALUES('Sell', 'Electronics', {'Mobile': {value : ['Laptop']});
like image 164
doanduyhai Avatar answered Sep 20 '22 20:09

doanduyhai


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.

like image 24
Daniel Gasperut Avatar answered Sep 21 '22 20:09

Daniel Gasperut