The Internet
The Internet

Reputation: 8123

What is the idiomatic way to perform a migration on a dynamo table

Suppose I have a dynamo table named Person, which has 2 fields, name (string), age (int). Let's assume it has a TB worth of data and experiences a small amount of read throughput, but a ton of write throughput. Now I want to add a new field called Phone (string). What is the best way to go about moving the data from one table to another?

Note: Dynamo doesn't let you rename tables, and fields cannot be null.

Here are the options I think I have:

How can I do perform a dynamo migration on a large table w/o significant data loss?

Upvotes: 1

Views: 407

Answers (1)

Mircea
Mircea

Reputation: 10566

you don't need to do anything. This is NoSQL, not SQL. (i.e. there is no idiomatic way to do this as you normally don't need migrations for NoSQL) Just start writing entries with the additional key.

Records you get back that are written before will not have this key. What you normally do is have a default value you use when missing.

If you want to backfill, just go through and read the value + put the value with the additional field. You can do this in one run via a scan or again do it lazily when accessing the data.

Upvotes: 2

Related Questions