Monday, January 29, 2018

Delete multiple rows form cassandra

cqlsh 
> copy bypramod(username, id, random, columns) to '/tmp/tp.csv' WITH DELIMITER ='\t';


Shell 
grep ^PRIMARYKEY$'\t' tp.csv | awk -F'\t' '{print "delete from examplekeyspace.bypramod where username='\''" $1 "'\'' and id='\''" $2 "'\'' and random=" $3 ";"}' >secondfile.cql

On new keyspace import the file.

cqlsh
source 'seconfile.cql'

***

No comments:

Post a Comment