Artist
.SongTitle
as the sort key.<table-name>
table. The PartiQL is
a SQL-compatible query language for DynamoDB.INSERT INTO "<table-name>" VALUE {'Artist':'No One You Know','SongTitle':'Call Me Today', 'AlbumTitle':'Somewhat Famous', 'Awards':'1'}
INSERT INTO "<table-name>" VALUE {'Artist':'No One You Know','SongTitle':'Howdy', 'AlbumTitle':'Somewhat Famous', 'Awards':'2'}
INSERT INTO "<table-name>" VALUE {'Artist':'Acme Band','SongTitle':'Happy Day', 'AlbumTitle':'Songs About Life', 'Awards':'10'}
INSERT INTO "<table-name>" VALUE {'Artist':'Acme Band','SongTitle':'PartiQL Rocks', 'AlbumTitle':'Another Album Title', 'Awards':'8'}
Query the data by
SELECT * FROM "<table-name>" WHERE Artist='Acme Band' AND SongTitle='Happy Day'
From your local machine, write some more items using the aws dynamodb put-item
command.
Use the aws dynamodb get-item
to get some item.
Write
aws dynamodb put-item --table-name Music --item '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}, "Awards": {"N": "1"}}'
Get
aws dynamodb get-item --table-name Music --key '{ "Artist": {"S": "Acme Band"}, "SongTitle": {"S": "Happy Day"}}'
AlbumTitle
.AlbumTitle-index
.Leave the other settings on their default values and choose Create index.
SELECT * FROM "<table-name>"."AlbumTitle-index" WHERE AlbumTitle='Somewhat Famous'
Enter the interactive self-check page
Database migration is the process of transferring data and schema from one database to another, typically when transitioning to a new system or version.
Zero downtime database migration refers to the seamless migration of a database without any interruption or impact on the availability of the system. It involves careful planning, replication, and synchronization techniques to ensure continuous service while transitioning to the new database environment.
mongo
docker container.db_migration/init.py
. The script should write new data to your running mongo every second. Keep this script running while you work on your next step.db_migration/init.py
, create another script called mirror_db.py
such that every data that is written to mongo will be written to dynamoDB table (create this table with dataId
as a partition key).try...except
to catch and handle the case where the write operation for either mongo or dynamo is failed.mirror_db.py
script. From now on, every piece of data is being written to both mongo and dynamo. You only need to create to the data written before you started the mirror script.After a while… stop the mirror_db.py
script and check that the data stored in both DBs is identical (you may write some python script for that).
Restore your table to how it was looking like a few minutes ago.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/PointInTimeRecovery.Tutorial.html#restoretabletopointintime_console