Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CQL Cassandra - How to use SELECT result in INSERT OR UPDATE

Tags:

cassandra

cql

I'm really a beginner in Cassandra stuff. I need to use some SELECT result in my INSERT. Something like this:

insert into  data_tbl
  (value_type, time, value, key_id) 
values
  (
   'test1', 
   now(), 
   'my first value',
   (select key_id from keys where key='123') 
  );

Is it possible ?

like image 501
VitalyC Avatar asked Jan 10 '23 00:01

VitalyC


1 Answers

As far as I know, you would need to do this programmatically in your application. First do the select on the keys table, then as you read each row from the result set in a loop, do an insert into your data_tbl.

like image 136
Jim Meyer Avatar answered May 16 '23 09:05

Jim Meyer