I am working with Scylla (Cassandra) db and trying to create tables which is dealing with User-Defined Types as shown below:
CREATE TYPE process (
id int,
discount float
);
CREATE TYPE service (
id int,
url text
);
CREATE TABLE data (
id int PRIMARY KEY,
fname text,
lname text,
service set<frozen<service>>,
monthly_process frozen<process>
);
My confusion is how can I insert data in my data table. Problem is I am confuse how process and service type works here and how can I insert values in them?
I tried with below example but it gave me an error:
insert into test (id, fname, lname, service, monthly_process )
values (1, 'abc', 'world', {'service': [{'id':1, 'url': 'some_url1'},
{'id':2, 'url': 'some_url2'}]}, {'id':1, 'discount': 10.0});
Error I got:
InvalidRequest: Error from server: code=2200 [Invalid query]
message="Invalid map literal for service of type set<frozen<service>>"