question

shyamvr_191673 avatar image
shyamvr_191673 asked Erick Ramirez answered

How do I restore a snapshot if I alter a table?

how do I restore a previous backed up snapshot If I alter a table by adding new column or change the partition key of the table

restore
10 |1000

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

Restoring an old schema

The snapshot itself contains a copy of the schema in a file called schema.cql.

When you want to restore a table with a different schema, you will need to:

  1. DROP the table.
  2. Recreate the schema using schema.cql file.
  3. Restore the SSTables from the snapshot.

NOTE: You will lose the data created after the snapshot was taken.

New partition key

It is not possible to change the partition key of a table once it's been created.

If you need a new partition key, you will need to start from scratch and create a new table.

If you want to import the data in old table, you will need an ETL tool (like a Spark job) or write an app that will migrate the data to the new table. Cheers!

Share
10 |1000

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