I am trying to build an ios application using Amazon's App Sync, DynomiteDB and GraphQL. I have set up one table that I am able to send API calls to. However, I created a new table in my database and wrote queries for it in the Graphql schema. However, when I make a call to create a new object in the table I get the error: Error saving the item on server: [Unable to assume role arn: ... I am wondering if it is possible to query two different tables that do not have an explicit relationship (IE. one of the tables contains a list of the objects contained in the other table).
1 Answer
With DynamoDB unit resolvers, you can query against a single table (outside of DynamoDB Batch Operations but those are reserved for bulk use cases) https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html
With Pipeline resolvers, you can query multiple tables but the calls are sequential (query table A, then query table B and so on) and can't be dynamic (you can't query table A and loop through the results and for each item issue a query against table B). Pipeline resolvers are very useful to perform checks, like doing an auth call from table A and then query from table B.
If your use case is more complex, I would advise using a Lambda data source and do the DynamoDB calls inside the Lambda, with the added bonus of being able to use your favorite programming language.