incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Khangaonkar <khangaon...@gmail.com>
Subject Re: CQL3 delete using < or > ?
Date Sun, 09 Feb 2014 02:45:49 GMT
Hi ,

>From CQL documentation , for the CQL delete statement , the only allowed
row specifications are

primary_key_name = key_value
primary_key_name IN ( *key_value, key_value, ...*)

regards




On Sat, Feb 8, 2014 at 6:09 PM, Clint Kelly <clint.kelly@gmail.com> wrote:

> Folks,
>
> Is there any way to perform a delete in CQL of all rows where a
> particular columns (that is part of the primary key) is less than a
> certain value?  I believe that the corresponding SELECT statement
> works, as in this example:
>
> cqlsh:fiddle> describe table foo;
>
> CREATE TABLE foo (
>   key text,
>   fam text,
>   qual text,
>   version int,
>   val text,
>   PRIMARY KEY (key, fam, qual, version)
> ) WITH
>   bloom_filter_fp_chance=0.010000 AND
>   caching='KEYS_ONLY' AND
>   comment='' AND
>   dclocal_read_repair_chance=0.000000 AND
>   gc_grace_seconds=864000 AND
>   index_interval=128 AND
>   read_repair_chance=0.100000 AND
>   replicate_on_write='true' AND
>   populate_io_cache_on_flush='false' AND
>   default_time_to_live=0 AND
>   speculative_retry='99.0PERCENTILE' AND
>   memtable_flush_period_in_ms=0 AND
>   compaction={'class': 'SizeTieredCompactionStrategy'} AND
>   compression={'sstable_compression': 'LZ4Compressor'};
>
> cqlsh:fiddle> select * from foo;
>
>  key   | fam  | qual | version | val
> -------+------+------+---------+--------
>  Clint | info | hair |       5 |  brown
>  Clint | info | hair |      10 | blonde
>
> (2 rows)
>
> cqlsh:fiddle> select val from foo where key='Clint' and fam='info' and
> qual='hair' and version <= 5;
>
>  val
> -------
>  brown
>
> (1 rows)
>
> cqlsh:fiddle> delete val from foo where key='Clint' and fam='info' and
> qual='hair' and version <= 5;
> Bad Request: Invalid operator LTE for PRIMARY KEY part version
>
>
> I assume the only way I can implement the functionality I'm looking
> for is to do a select, get a list of all of the elements that I want
> to delete, and then delete them in a big batch statement.  Is that
> correct?
>
> Thanks!
>
> Best regards,
> Clint
>



-- 
http://khangaonkar.blogspot.com/

Mime
View raw message