*Please make sure you have installed and running docker on your machine. Run:
docker compose upnpm installnpm startNote that after running the above command, all the transformation scripts in data-transformations folder will be executed. See the UsersExample table here: http://localhost:8001/
npx sls dynamodt --helpnpm install -g dynamo-data-transform
ddt -i- init -
ddt init -tableNames "Users" - up -
ddt up - down -
ddt down -t Users - prepare -
ddt prepare -t Users --tNumber 3 - history -
ddt history -t Users
-
For understanding how to prepare data for transformation, take a look at v4_using_preparation_data.js.
Move the filev4_using_preparation_data.jsto the data-transformations folder.mv EXERCISE-prepare-data/v4_using_preparation_data.js data-transformations/UsersExample
Let's check the
preparescript resultsnpx sls dynamodt prepare --table UsersExample --tNumber 4 --dry
The results in the console should be:
{ 'USER#21-NAME#Bradley Wiggins: true, 'USER#34-NAME#Chaos': true, 'USER#32-NAME#Knuckles': true, 'USER#29-NAME#Plankton': true, ... }
Now lets prepare some data for the transformation. Run the same command as before but without
--dry.npx sls dynamodt prepare --table UsersExample --tNumber 4 --stage localLet's run the pending transformation script, currently it is "v4_using_preparation_data.js"
npx sls dynamodt up --stage localNow open the dynamodb GUI and check the data.
http://localhost:8001/ -
Rollback the last transformation
npx sls dynamodt down --stage local --table UsersExample --dryNow you will see in the console that
hasWikiPagefield was removed from each item.
Let's rollback the last transformation for real.npx sls dynamodt down --stage local --table UsersExampleNow open the dynamodb GUI and check the data.