How to update/query/scan in DynamoDB using Amplify?
See original GitHub issueI would like to update a field in my DynamoDB table called ‘AppTable’ using the AWS-Amplify methods that were generated when I created the corresponding CRUD cloud-api (e.g. PUT, GET, POST, DELETE).
These few API methods reside in awsmobilejs/backend/cloud-api/AppTable/app.js, but they are not comprehensive enough!
I can simply use API.put to add to this table. e.g:
apiResponse = API.put('AppTableCRUD', path, body)
body: {
"uploaderBool": true,
"userId": 'user1',
"itemId": '10005',
"Username": "first_app_user",
"Email": "user@myapp.com",
"NumberList":
[
"7.9",
"5.7",
"3.4",
"4.9"
],
"AverageNumber":[
"5.5"
],
}
}
What i want to do, is update the NumberList field with a function in my react-native app, count how many numbers in the list on DynamoDB, then calculate/write an updated number called AverageNumber.
If i use a current API.put method i have to put in this ENTIRE body everytime (this list could be hundreds of thousand of entries so Get, then Put with a single update is absurd).
How do you use the .scan(), .query() and .update() method that DynamoDB has with Amplify?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:18 (8 by maintainers)

Top Related StackOverflow Question
Hi @chai86, I created graphql api using aws-amplify-cli with this app code (react web)
it seems that
inputattribute is missing so it should be like thisawait API.graphql(graphqlOperation(createVideo, { input: newVideoInfo }))@chai86 I am glad it works! 😄