You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Baskar Duraikannu <ba...@outlook.com> on 2013/09/03 23:11:50 UTC

RE: Update-Replace

I have a similar use case but only need to update portion of the row. We basically perform single write (with old and new columns) with very low value of ttl for old columns. 

> From: jan.algermissen@nordsc.com
> Subject: Update-Replace
> Date: Fri, 30 Aug 2013 17:35:48 +0200
> To: user@cassandra.apache.org
> 
> Hi,
> 
> I have a use case, where I periodically need to apply updates to a wide row that should replace the whole row.
> 
> The straight-forward insert/update only replace values that are present in the executed statement, keeping remaining data around.
> 
> Is there a smooth way to do a replace with C* or do I have to handle this by the application (e.g. doing delete and then write or coming up with a more clever data model)?
> 
> Jan
 		 	   		  

Re: Update-Replace

Posted by Jan Algermissen <ja...@nordsc.com>.
Baskar,

On 03.09.2013, at 23:11, Baskar Duraikannu <ba...@outlook.com> wrote:

> I have a similar use case but only need to update portion of the row. We basically perform single write (with old and new columns) with very low value of ttl for old columns. 

I found out that using bound statements with java-driver works quite well for this case because the fields with a ? in the prepared statement but without a bound value will be automatically set to null - hence removed.

So this actually automagically does what you/I want.

See <https://groups.google.com/a/lists.datastax.com/d/msg/java-driver-user/APfnKNTXuvE/gBeCk37jgRAJ>

Jan

> 
> > From: jan.algermissen@nordsc.com
> > Subject: Update-Replace
> > Date: Fri, 30 Aug 2013 17:35:48 +0200
> > To: user@cassandra.apache.org
> > 
> > Hi,
> > 
> > I have a use case, where I periodically need to apply updates to a wide row that should replace the whole row.
> > 
> > The straight-forward insert/update only replace values that are present in the executed statement, keeping remaining data around.
> > 
> > Is there a smooth way to do a replace with C* or do I have to handle this by the application (e.g. doing delete and then write or coming up with a more clever data model)?
> > 
> > Jan