12

I need to add some new columns to my existing column_family/table in cassandra. I can add single column like this :

ALTER TABLE keyspace_name.table_name ADD column_name cql_type;

Can I add all new columns using a single query? If yes, how to do it using cql and datastax cassandra driver?

Pankaj Goyal
  • 1,448
  • 3
  • 15
  • 25
  • 1
    I think it is not possible. See: http://www.tutorialspoint.com/cassandra/cassandra_alter_table.htm and https://docs.datastax.com/en/cql/3.0/cql/cql_reference/alter_table_r.html. – Soumya Kanti Jan 05 '16 at 11:38
  • 3
    https://issues.apache.org/jira/browse/CASSANDRA-10411 – Yasmeen Jan 05 '16 at 11:52
  • Remember to be careful with schema agreement when modifying schema programmatically – phact Jan 05 '16 at 14:39

1 Answers1

23

This is fixed in Cassandra 3.6 https://issues.apache.org/jira/browse/CASSANDRA-10411

ALTER TABLE foo ADD (colname1 int, colname2 int)
Lucas B
  • 11,793
  • 5
  • 37
  • 50