P
P
Pavel Dudenkov2016-08-29 20:17:28
Java
Pavel Dudenkov, 2016-08-29 20:17:28

How to alter table add default value in Cassandra?

Good day to all.
We use two noSQL solutions on our project: monga and cassandra.
Before the release of the new version, the models changed and a Boolean field was added to maintain backward compatibility.
Accordingly, I add this field in Cassandra: ALTER TABLE x ADD y boolean;
But now this field essentially does not exist, they are all Null, and I need it to be False so that the interpretation of null does not spread through the code.
It turns out that I need to do a bulk update on the entire table, but I didn’t succeed. For example, I tried to create a secondary index, on a field that is now always = 0, and : UPDATE x SET y = false WHERE zero_field = 0; does not work.
Isn't there a way to get this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2016-09-08
@viperz

how to solve your problem:
in cassandra it is possible to update only by primary key, first you need to iterate over all records:
select from

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question