Unable to build a query with relationships #822
Unanswered
renebefort
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Error about You get You will need to specify custom resolver for this field that converts this value into iterable. Albo be careful about relationships in GraphQL or you will run into infamous N+1 problem that GraphQL has, where you will have extra database queries for every item turned in result set. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I am brand new to the topic and am currently programming a proof-of-concept. I have a problem when I connect two database tables via relations. Unfortunately I get no results from the sub-table in the query and a message in the trace.
My use-case
I have a table where orders are in it (AUFKOPF). In this table exists a column that references to another table. In this table are the order types (AUFTYPEN). The sub-table has a key. In the order table a column is referenced to the key.
AUFKOPF.AUFTYP ---- [N:1] ----> AUFTYPEN.AUFTRAGSTYP (STRING)
Attached is my setup
I use sqlalchemy for the connection to my database. My model definition looks like
models.py
My resolver looks like:
queries.py
My schema definition looks like:
schema.graphql
The query for getting Orders work very well. But I did not get any data from OrderType.
I can see the following message at the output from flask server, when I reload my client (https://studio.apollographql.com)
When I run the following query:
I get the result:
Always I get order_type_ref:NULL without any error message.
I hope someone can give me a type what I am doing wrong. I suspect it is not loading the sub table. But I do not know why.
Thanks a lot, René
Beta Was this translation helpful? Give feedback.
All reactions