Closed LoukasGP closed 1 year ago
Hi @LoukasGP - Your usecase can be achived by AppSync's BatchDeleteItem
operation.
Here is an example of BatchDeleteItem
operation from AppSync docs.
https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-dynamodb-batch.html
VTL programming guide: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-programming-guide.html#aws-appsync-resolver-mapping-template-reference-programming-guide
AppSync resolver tutorials: https://docs.aws.amazon.com/appsync/latest/devguide/tutorials.html
Please see if these help. Let us know if you have questions.
Which Category is your question related to?
API.graphql
mutationAmplify CLI Version Version: 8.0.1
What AWS Services are you utilizing? AppSync
Provide additional details e.g. code snippets. Be sure to remove any sensitive data.
I've come across this documentation that notes batch is not supported, and thus requires a custom resolver.
I've also come across this feature request for cascading delete with DynamoDB Streams and Lambda.
I see there is an example for a batch put custom resolver, however, I'm new to VTL transformers, and would like some guidance for setting up a batch delete transformer.
Use Case:
There is a
@model
for JobListing, and one for Images. They have a ManyToMany Relationship. When I delete an Image record from DynamoDB, all JobListingImage records for that image need to be deleted as well.I've considered looping through the JobListingImage records, but there could be a possiblity where there are 100,000 records to query and then delete. This does not appear like a good, nor viable solution.
Any help would be appreciated,
Luke