You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Peng Xiao <25...@qq.com> on 2017/12/04 03:13:02 UTC

update a record which does not exists

Dear All,If we update a record which actually does not exist in Cassandra,will it generate a new record or exit?


UPDATE columnfamily SET data = 'test data' WHERE key = 'row1';

as in CQL Update and insert are semantically the same.Could anyone please advise?


Thanks,
Peng Xiao

Re: update a record which does not exists

Posted by Oleksandr Shulgin <ol...@zalando.de>.
On Mon, Dec 4, 2017 at 4:13 AM, Peng Xiao <25...@qq.com> wrote:

> Dear All,
> If we update a record which actually does not exist in Cassandra,will it
> generate a new record or exit?
>
> UPDATE columnfamily SET data = 'test data' WHERE key = 'row1';
> as in CQL Update and insert are semantically the same.Could anyone please
> advise?
>

If you're looking for a way to update only existing records you need UPDATE
IF EXISTS, which invokes an LWT.

Cheers,
--
Alex

Re: update a record which does not exists

Posted by "@Nandan@" <na...@gmail.com>.
In Cassandra, We are having Upsert concept. That means, Suppose if you
inserting data then it is going to store based on your PK, once you will
Update records based on PK, then there will be 2 possibilities as:-
1) Either It updates the Existed data with new Timestamp [as we know that
record having VALUE as well as TIMESTAMP].
2) Insert a new record in case of non-existing data.

Thanks.

On Mon, Dec 4, 2017 at 11:47 AM, Peng Xiao <25...@qq.com> wrote:

> After test,it do will insert a new record.
>
>
> ------------------ Original ------------------
> *From: * "我自己的邮箱";<25...@qq.com>;
> *Date: * Mon, Dec 4, 2017 11:13 AM
> *To: * "user"<us...@cassandra.apache.org>;
> *Subject: * update a record which does not exists
>
> Dear All,
> If we update a record which actually does not exist in Cassandra,will it
> generate a new record or exit?
>
> UPDATE columnfamily SET data = 'test data' WHERE key = 'row1';
> as in CQL Update and insert are semantically the same.Could anyone please
> advise?
>
> Thanks,
> Peng Xiao
>
>

Re: update a record which does not exists

Posted by Peng Xiao <25...@qq.com>.
After test,it do will insert a new record.




------------------ Original ------------------
From:  "我自己的邮箱";<25...@qq.com>;
Date:  Mon, Dec 4, 2017 11:13 AM
To:  "user"<us...@cassandra.apache.org>;

Subject:  update a record which does not exists



Dear All,If we update a record which actually does not exist in Cassandra,will it generate a new record or exit?


UPDATE columnfamily SET data = 'test data' WHERE key = 'row1';

as in CQL Update and insert are semantically the same.Could anyone please advise?


Thanks,
Peng Xiao