Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

xenobius.lee_170168 avatar image
xenobius.lee_170168 asked ·

How to update primary key value of createddate?

Dear,

I have datasets having each different created date. But our cassandra db was consisted of primary key with created data which should be created with inserted time.

After inserting datasets, I want to update real time generated created date with each different created date but I don't know how to update this.

Please someone help me to resovle this.


Regards,

update primary key
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

Since the column is part of the primary key then you cannot modify it. It breaks the fundamental purpose of a primary key. By definition it is what makes it unique and determines how the data is partitioned in the cluster.

Updating the values of a primary key (an "upsert" in Cassandra) effectively inserts a new partition because the primary key with the new value does not exist so it just gets created like a normal INSERT. See CQL UPDATE command. Cheers! :)

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.