question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
raphkimcommented, Mar 9, 2021

Additionally, we are in the process of making some further changes so that the workaround won’t be required at all. Instead, you will be able to do something like this:

The codegen changes are now live with amplify-codegen@2.22.1.

Use the latest version of Amplify CLI (currently on v4.45.0) to use enhanced model fields. Note that you have to update your Amplify Android library version to at least v1.16.11 (currently on v1.17.0) to be able to use this feature.

Now instead of field("Activity_id").eq("123"), you can directly use the static field from your classes like this: Activity.ID.eq("123").

1reaction
richardmcclellancommented, Feb 3, 2021

Hi @upachecog, as you noted, there was a regression in 1.6.10, which broke the workaround which you had in place. This regression has been fixed in the latest version, 1.16.11, so please give it a try and let us know if it is resolved for you.

Additionally, we are in the process of making some further changes so that the workaround won’t be required at all. Instead, you will be able to do something like this:

Activity.ID.eq(activityId)
Location.ID.eq(taskId)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sqlite : ambiguous column name - Stack Overflow
I'm a newbie and i try to do that on my database. SELECT id FROM import a INNER ...
Read more >
How to Solve the “Ambiguous Name Column” Error in SQL
There are various ways to solve the “ambiguous name column” bug. One of the simplest ways to solve it is explained below.
Read more >
Why Is This Name Ambiguous? - ADocLib
messageError in querying the model. causeandroid.database.sqlite.SQLiteException: ambiguous column name: id code 1 SQLITEERROR #908.
Read more >
Ambiguous 'ambiguous error', is it normal or bug? - SQLite Forum
SELECT * FROM t a JOIN t b ORDER BY s;. You first get a full dataset (or however it is named internally)...
Read more >
What does the SQL 'ambiguous column name' error mean?
Ambiguous error means that you are calling a certain field in which exist in both Table and the SQL has no idea where...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found