I need to write roll-in and roll-back scripts for AWS Keyspaces. Roll-in is
ALTER TABLE my_table ADD (
next_value_1 double,
next_value_2 double,
);
What roll-back script should be? According to what's written at Tutorial: Delete data in an Amazon Keyspaces table I can't drop columns from a table.
You can delete a column from a specific row, individual rows from a table, all the rows from a table, an entire table, or a keyspace.
Also there's no ALTER TABLE xxx DROP ()
mentions in DDL statements page.
Is there any way to do this?
CodePudding user response:
It looks like you cannot. From the doc mentioned in the original post, the supported syntax is:
ALTER TABLE table_name
[ ADD ( column_definition | column_definition_list) ]
[[ADD | DROP] TAGS {'key1':'val1', 'key2':'val2'}]
[ WITH table_options [ , ... ] ] ;
It looks like you can ADD
and DROP
tags, but you can only ADD
columns. If you need to DROP
a column, it looks like you'll have to recreate the table.
Despite how AWS Keyspaces is touted as a drop-in replacement for Cassandra, there are many things that it simply does not support.
Note that ALTER TABLE table_name DROP column_name
does indeed work in both Apache Cassandra and DataStax Astra DB.