Closed meetrij closed 5 years ago
See batch resolvers in the Appsync documentation:
https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-dynamodb-batch.html
But, depending on your use case, just remember dynamo has a batch limit of 25 (splitEvery by ramda in a composition can come in handy there)
BatchWriteItem A single BatchWriteItem operation can contain up to 25 PutItem or DeleteItem requests. The total size of all the items written cannot exceed 16 MB.
Or, when performing the mutation, you can do something like :
const CreateMasterCrop = `mutation CreateMasterCrop($input: CreateMasterCropInput! ){
createMasterCrop(input: $input){
${MasterCropInput}
}
}`
const crops = [
{ input: { cropId: 1, cropCode: 'RC', cropName: 'Rice' } },
...otherCrops,
]
const mutateManyItems = mutation => async items =>
Promise.all(
items.map(input => API.graphql(graphqlOperation(mutation, input)))
)
mutateManyItems(CreateMasterCrop)(crops).then(...).catch(...)
@meetrij I agree with @pigmanbear's explainaton but you should be aware of AppSync throttling levels if you're using a Proime.all() from your client - it's basically 1,000 queries per second. You can find more information out here - https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_appsync
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
I have a type as shown below
Mutation generated against this is like
API.service.ts file generated like this
suppose I want to add multiple data like
in a single API call, how could I do? As now only provision to add single row item at a time.