cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorvaldsson Justus <justus.thorvalds...@svenskaspel.se>
Subject SV: Query on delete a column inside a super column
Date Wed, 07 Jul 2010 07:06:03 GMT
This is my first email, just started with Cassandra, I think you want to use Mutate object
or something like it "The Mutation object can also be used to create new Columns or to delete
a Column, if you supply it with a key that doesn't exist in the database it will create it,
if it detects that the key already exists it will overwrite the value and the timestamp. "
from a java tutorial on Cassandra. I may be wrong but thought I could try to help.

Regards
Justus

Från: Moses Dinakaran [mailto:mosesdinakaran@gmail.com]
Skickat: den 7 juli 2010 08:51
Till: user@cassandra.apache.org
Ämne: Re: Query on delete a column inside a super column

Hi,

Thanks for the reply,

The remove method
$cassandraInstance->remove('cache_pages_key_hash', 'hash_1' )

which will remove the whole key, But I don't want to do that, I need to remove one column
inside that key

Can you please tell me how to use the remove method in this case.


Regards,
Moses.

On Wed, Jul 7, 2010 at 12:16 AM, Jonathan Ellis <jbellis@gmail.com<mailto:jbellis@gmail.com>>
wrote:
insert is insert-or-update.  leaving out a column from an update
doesn't delete it, you need to use the remove method for that.

On Tue, Jul 6, 2010 at 7:41 AM, Moses Dinakaran
<mosesdinakaran@gmail.com<mailto:mosesdinakaran@gmail.com>> wrote:
> Hi All,
>
> I have a query related to deleting a column inside a super column
>
> The following is my cassandra schema
>
> [cache_pages_key_hash] => Array
>        (
>            [hash_1] => Array
>                (
>                    [1] => 4c330e95195f9
>                    [2] => 4c330e951f18b
>                    [3] => 4c330e9521f3d
>                )
>
>        )
>
>
> No I wanted to remove the index [1] => 4c330e95195f9 from the
> supercolumn [hash_1]
>
> Through phpCassa I am doing the following
>
> $updatedRecord   =  array("hash_1" => Array
>                                (
>                                    2 => "4c330e951f18b"
>                                    3 => "4c330e9521f3d"
>                               )
>                             )
>
>
> $cassandraInstance->insert('cache_pages_key_hash',$updateRecord );
>
> But while I fetch the record again
>
> I was getting the original records ie the column 1 is not removed from
>
>
> [cache_pages_key_hash] => Array
>        (
>            [hash_1] => Array
>                (
>                    [1] => 4c330e95195f9
>                    [2] => 4c330e951f18b
>                    [3] => 4c330e9521f3d
>                )
>
>        )
>
>
> But at the same time If I am updating the index 1
>
> ie
> $updateRecord   =  array("hash_1" => Array
>                                (
>                                   1  => ' able to update'
>                                    2 => "4c330e951f18b"
>                                    3 => "4c330e9521f3d"
>                               )
>                             )
>
> $cassandraInstance->insert('cache_pages_key_hash',$updateRecord );
>
> The records is being updated, Only problem is that  deleting dosent happens.
>
> My question is that is this behavior is expected as explained in the article
> Distributed deletes in the Cassandra database
> http://spyced.blogspot.com/2010/02/distributed-deletes-in-cassandra.html
>
> or I am doing wrong.
>
>
> Thanks,
> Moses.
>


--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com


Mime
View raw message