Using multiple tables in Android application using AWS DynamoDB

Viewed 124

I am using an AWS DynamoDB database for my Android application. I am using AWS Amplify API (GraphQL API) to query and mutate.

However, I am not able to interact with two or more tables. I want to know how to purposefully have 2 or more table use. I am new to it and can't figure out. Thanks.

1 Answers

You can simply create two separate schema such as :

type Table1 @model {
  id: ID!
  name: String!
  posts: [Post] @connection(name: "BlogPosts")
}

type Table2 @model {
  id: ID!
  title: String!
  blog: Blog @connection(name: "BlogPosts")
  comments: [Comment] @connection(name: "PostComments")
}

you will have a graphql folder created which will contain the sample code for mutation , update and query for both of the tables.

Related