-
Notifications
You must be signed in to change notification settings - Fork 12
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
batch lookup #181
Comments
Hello 👋 Aliasing is one of the ways that batching can be implemented (but also gets somewhat complex pretty fast). Our suggested approach for handling batching is to use variable batching (combined with request batching if necessary). See #25 and graphql/graphql-over-http#307. |
/facepalm Sorry, thought of creating an issue but somehow didn't occur to me to search for one. Thank you for the quick answer. Hum, I see the problem but I'm not sure what to think of it. Not having batching capabilities forces the use of data loaders to be even remotely efficient. However, in our gateway everything is already batched together and most often an appropriate batch resolver will be available. So I see this as a performance hit. Off the top of my head, I think I would handle it the following way:
So in this case: type Query {
orderById(id: ID!): Order
ordersById(ids: [ID!]!): [Order]!
}
type Order {
id: ID!
deliveryEstimate(dimension: ProductDimensionInput! @require(fields: "product { dimension }")) : Int!
} I would change the fields to type Query {
orderById(id: OrderInput!): Order
ordersById(ids: [OrderInput!]!): [Order]!
}
input OrderInput {
id: ID!
dimension: ProductDimensionInput
}
type Order {
id: ID!
deliveryEstimate(dimension: ProductDimensionInput! @require(fields: "product { dimension }")) : Int!
} It does require dedicated support from the subgraph GraphQL framework to make it more or less transparent compared to variable batching and others, so it's similar to Apollo federation in that regard. It's less dynamic than For the current use cases I can think of for extensions, that would work for us. I'm not sure how relevant it is for this specification though. My primary goal is to at least not to go against this specification. Let me know if I should write it in #25. |
Moved the conversation there, so closing this issue. Thanks again for pointing me to it |
Hi! I'm from Grafbase and we're considering implementing part of this spec to support entities across our subgraphs defined with extensions (REST services, NATS, Postgres, etc.).
I've noticed that there is no notion of batching in here even though in practice we would often end up with fields like:
To my current understanding, the current spec only supports the following:
forcing us to "batch" manually with a query like:
While it works, it's definitely less efficient if a batch field exists.
From what I've seen of the current specification, It seems like
@lookup
could automatically be treated as a batch whenever it returns a list and it has a single argument that is a list? Any opinion? Do you have something else planned?The text was updated successfully, but these errors were encountered: