Amplify-android: message=Error in querying the model., cause=android.database.sqlite.SQLiteException: ambiguous column name: id (code 1 SQLITE_ERROR)

Created on 16 Oct 2020  Â·  2Comments  Â·  Source: aws-amplify/amplify-android

This is my schema ↓↓↓

type User @model {
  id: ID!
  password: String!
  card: [Card] @connection(name: "createdUser")
}

type Card @model {
  id: ID!
  user: User @connection(name: "createdUser")
  date: AWSDateTime!
  category: Int!
  goalItem: Int
  goalValue: Float
  achieve: Float
  reaction: [Reaction] @connection(name: "getReaction")
}

type Reaction @model {
  id: ID!
  card: Card @connection(name: "getReaction")
  category: Int!
  item: Int
}

When I used the ID of card as a predicate, there is an error. ↓↓
image

When I use another field for the predicate, eg. User of Card as a keyword, there is no problem:
image

I don't know why. Who can help me?

Bug DataStore

All 2 comments

Hi @shirui0413 ,

There is currently an issue with column ambiguity when querying with relational models. Please see the **NOTE** in the following doc to work around this issue.

Rather than using Card.ID and Reaction.ID, please try using QueryField.field("Card_id") and QueryField.field("Reaction_id").

We believe this can be resolved by updating code that generates our Java models, here.

Was this page helpful?
0 / 5 - 0 ratings