Search code examples
cassandracql3

Cassandra CQL 3.2.1 Clear column data


I need to clear the data from a column in a table using CQL I've tried the following test on a single node and it works fine.

But is this going to fly on many nodes and different replication factors?

DROP KEYSPACE IF EXISTS testColumnDrop;

CREATE KEYSPACE testColumnDrop WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

USE testColumnDrop;

CREATE TABLE contracts (
  id varchar PRIMARY KEY,
  licenses varchar
);

INSERT INTO contracts(id, licenses) VALUES('one', '{"number":"1.0"}');
INSERT INTO contracts(id, licenses) VALUES('two', '{"number":"2.0"}');
INSERT INTO contracts(id, licenses) VALUES('three', '{"number":"3.0"}');

SELECT * FROM contracts;

ALTER TABLE contracts DROP licenses;

ALTER TABLE contracts ADD licenses varchar;

SELECT * FROM contracts;

Solution

  • I tried it using Docker and a cluster of three nodes, worked fine