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
[PRO] Connection based query splitting #4917
Comments
Hey, thanks for the detailed writeup. I definitely agree it'd be good to find a way to make this more stable for you. That said ... if I re-wrote the parser from scratch and the only thing that broke was a change from an options hash to "real" keyword arguments, I'd say we're doing pretty good! Some precedent here is Since I don't know of anyone manipulating queries in exactly this way, my first choice would be to understand what existing Nodes APIs you use and properly test them so that I don't accidentally break them in the future (at least, not without due heads-up in the changelog). Alternatively, if you want to open a PR or share a gist with your implementation of Let me know what you think. |
Yeah, absolutely 😄 I can start by opening a PR that adds our functionality directly to GraphQL Ruby and go from there! That will at least give you a clearer picture of the Node APIs we're currently using. |
Thanks again for sharing that code. I added some tests for the accidentally-broken methods in 1c3af64, so I think that's all we need for now. Please let me know if you run into any more trouble with AST nodes! |
Is your feature request related to a problem? Please describe.
We have a public API that is rate limited. This rate limiting is painful for reporting based apps that want to query large amounts of data. They are guaranteed to be rate limited if their query has two nested connection fields. They will have to paginate until they gather all of the data.
Ultimately, this means our API is very friendly for feature focused apps that are executing mutations and dealing with small payloads, but unfriendly for reporting based apps. To allow apps to make arbitrarily large queries, we have created a system that will split queries with multiple connections into individual queries. We then query each nested query individually. For example, this query:
is split like so:
We then execute each of the separated, paginated queries and collect the results in a JSON file which the app can query for when it is completed. This will work for an arbitrarily large query that I can give you more examples of if needed!
This is a working system that we currently have. The challenge we're facing is that this has broken on the last two GraphQL Ruby upgrades we have done. The breakage is very understandable as you wouldn't be expecting us to use parts of the
GraphQL::Language
API that we need to here. For example, it breaks on this when attempting to upgrade our current version because of a change in this PR:Describe the solution you'd like
It would be amazing if this was possible directly through GraphQL Ruby. For example:
Which would split an arbitrarily large query with N number of nested connections similar to the way I shared above. We could then use that and not have to worry about future breakages 😄
Describe alternatives you've considered
Nothing currently. We're considering dropping support for this feature as it's become a challenge for GraphQL Ruby upgrades with only a few people here knowing how to fix it when those breakages happen.
Additional context
Thank you for taking the time to read this!
The text was updated successfully, but these errors were encountered: