Post

Replies

Boosts

Views

Activity

Amplify/GraphQL - Issue getting full data with one-to-one relationship
Just to give some background, we have two tables with a one to one relationship. So, Table A has a one-to-one relationship with Table B. With amplify, I see that Table A has a foreign key for Table B. When we do a query to fetch a list of items using a filter, we call for a list of items from Table A. With graphQL, since we have the @hasOne key, the data from table B will be nested inside each row from table A data. When I test the raw graphQL query itself on amplify's console, it's fine, but on xcode, the nested data from Table B is showing up as null. Has anyone have an idea on what is causing this? If you need clarification, do not hesitate to let me know! Some things I have tried are here: https://docs.amplify.aws/cli/migration/lazy-load-custom-selection-set/ Now, I have set "generateModelsForLazyLoadAndCustomSelectionSet" to true, but it caused a compilation error. One of the message is that "LazyReference" has not been found. So, I've been having trouble implementing one of the suggestions. The main problem is that, how can I have data from table B show up in my results when I query for a list of items from table A? This is only happening with 'hasOne' relationship.
0
0
350
Nov ’23