Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL statement "root"."postUserIdId" = ?" should be "root"."userId" = ?" #510

Closed
lawmicha opened this issue Jun 2, 2020 · 2 comments
Closed
Assignees
Labels
bug Something isn't working datastore Issues related to the DataStore category duplicate This issue or pull request already exists

Comments

@lawmicha
Copy link
Contributor

lawmicha commented Jun 2, 2020

I have a separate but potentially related issue regarding DataStore. I have put a message out in discord https://discord.com/channels/705853757799399426/707328996995760179/717494199875797092 if you have a minute would you mind checking?

In summary, when I use self.users?.posts?.count the output fails (I have tested and the data exists online 1:m posts

Here is the output:

`no such column: root.postUserIdId in "select
  "root"."id" as "id", "root"."createdTimestamp" as "createdTimestamp", "root"."imageUrl" as "imageUrl",
  "root"."text" as "text", "root"."updatedTimestamp" as "updatedTimestamp", "root"."userId" as "userId"
from Post as root
where 1 = 1
  and "root"."postUserIdId" = ?"
Fatal error: The operation couldn’t be completed. (SQLite.Result error 0.): file /Users/development/Documents/Development/AWS/FullStackSocial/Pods/Amplify/Amplify/Categories/DataStore/Model/Collection/List+LazyLoad.swift, line 96
2020-06-02 22:47:50.150875+0100 FullStackSocial[45576:1966345] Fatal error: The operation couldn’t be completed. (SQLite.Result error 0.): file /Users/development/Documents/Development/AWS/FullStackSocial/Pods/Amplify/Amplify/Categories/DataStore/Model/Collection/List+LazyLoad.swift, line 96`

Model (note that I added userId and no connection to Post):

`type User @model {
  id: ID!
  fullName: String!
  emailAddress: String
  bio: String
  profileImageUrl: String
  isFollowing: Boolean
  following: [UserFollowing] @connection (keyName: "following", fields: ["id"])
  followers: [UserFollowers] @connection (keyName: "followers", fields: ["id"])
  isEditable: Boolean
  posts: [Post] @connection(keyName: "posts", fields: ["id"])
  createdTimestamp: Int!
  updatedTimestamp: Int
}

type UserFollowing @model @key(name: "following", fields:["userId"]) {
  id: ID!
  userId: ID!
}

type UserFollowers @model @key(name: "followers", fields:["userId"]) {
  id: ID!
  userId: ID!
}

type Post @model @key(name: "posts", fields:["userId", "createdTimestamp"], queryField: "postsByCreatedtimestamp" )  {
  id: ID!
  userId: ID!
  text: String
  imageUrl: String
  createdTimestamp: Int!
  updatedTimestamp: Int
}`

Originally posted by @mickeysox in #483 (comment)

@lawmicha
Copy link
Contributor Author

lawmicha commented Jun 2, 2020

from @drochetti
"it seems to be a bug, in the SQL statement where it says and "root"."postUserIdId" = ?" it should be and "root"."userId" = ?" as per your schema"

https://discord.com/channels/705853757799399426/707328996995760179/717500699419607201

@royjit royjit added datastore Issues related to the DataStore category bug Something isn't working labels Jun 4, 2020
@drochetti drochetti added the pending-triage Issue is pending triage label Jun 24, 2020
@palpatim palpatim self-assigned this Jun 29, 2020
@palpatim palpatim removed the pending-triage Issue is pending triage label Jun 29, 2020
@drochetti drochetti added the duplicate This issue or pull request already exists label Jul 28, 2020
@drochetti
Copy link
Contributor

I can confirm this is a duplicate of #512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore Issues related to the DataStore category duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants