【问题标题】:Using multiple tables in Android application using AWS DynamoDB在使用 AWS DynamoDB 的 Android 应用程序中使用多个表
【发布时间】:2020-08-27 23:10:24
【问题描述】:

我正在为我的 Android 应用程序使用 AWS DynamoDB 数据库。 我正在使用 AWS Amplify API (GraphQL API) 进行查询和变异。

但是,我无法与两个或更多表进行交互。 我想知道如何有目的地使用 2 个或更多表。我是新手,无法弄清楚。谢谢。

【问题讨论】:

  • 你想如何从这两个表中拉取数据?数据是否相关。是数据层次结构。您需要提供更多信息

标签: android amazon-dynamodb aws-amplify aws-appsync


【解决方案1】:

您可以简单地创建两个单独的架构,例如:

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")
}

您将创建一个 graphql 文件夹,其中将包含两个表的突变、更新和查询的示例代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-17
    • 2016-04-11
    • 1970-01-01
    • 2015-09-16
    • 1970-01-01
    • 2016-08-06
    • 1970-01-01
    相关资源
    最近更新 更多