cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: How to delete a range of columns using first N components of CompositeType Column?
Date Thu, 23 Feb 2012 19:16:33 GMT
Unfortunately you can use column ranges for delete operations. 

So while what you want to do is something like...

Delete 'Jack:*:*'...'Jack:*:*' from Test where KEY = "friends";

You cannot do it. 

You need to read and then delete by name.

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 23/02/2012, at 8:08 PM, Praveen Baratam wrote:

> More precisely,
> 
> Lets say we have a CF with the following spec.
> 
> create column family Test
>     with comparator = 'CompositeType(UTF8Type,UTF8Type,UTF8Type)'
>     and key_validation_class = 'UTF8Type'
>     and default_validation_class = 'UTF8Type';    
> 
> And I have columns such as:
> 
> Jack:Name:First - Jackson
> Jack:Name:Last -  Samuel
> Jack:Age - 50
> 
> Now To delete all columns related to Jack, I need to use as far as I can comprehend
> 
> Delete 'Jack:Name:First', 'Jack:Name:Last', 'Jack:Age' from Test where KEY = "friends";
> 
> The problem is we do not usually know what meta-data is associated with a user as it
may include Timestamp based columns.
> 
> such as: Jack:1234567890:Location - Chicago
> 
> Can something like -
> 
> Delete 'Jack' from Test where KEY = "friends";
> 
> be done using the First N components of the CompositeType?
> 
> Or should we read first and then delete?
> 
> Thank You.
> 
> On Thu, Feb 23, 2012 at 4:47 AM, Praveen Baratam <praveen.baratam@gmail.com> wrote:
> I am using CompositeType columns and its very convenient to query for a range of columns
using the First N components but how do I delete a range of columns using the First N components
of the CompositeType column.
> 
> In order to specify the exact column names to delete, I would have to read first and
then delete.
> 
> Is there a better way?
> 


Mime
View raw message