News for hackers. Stuff that matters.
Re:GraphQL Is a Trap? by obi1kenobi on Friday May 06, 2022 @11:30AM (#31286333)
100% agree that pagination is extremely awkward, especially with nesting. Between the pagination problem and the "oops I asked for too much data and blew up the server" problem, I think it's more work than one might think to run a GraphQL API.

For my own work, I took things in a different direction: I made a query language that parses as legal GraphQL using a vanilla parser, but has directives like `@filter, @recurse, @optional` etc. Instead of returning a giant fully-nested result, it flattens results and emits them row-by-row like a SQL database. This means the query evaluation can be lazy and incremental — if you write a query that has a billion results but only load 20 of them, then only 20 rows' worth of work happens.

My company has been using this in production for 6 years now across everything from TB-scale SQL clusters with X00,000 tables/views, to querying our own codebase, configuration, and deployment information to find and prevent bugs. I gave a 10min talk at a conference about this recently, if you'd like to learn more: https://www.hytradboi.com/2022/how-to-query-almost-everythin...

Project GitHub: https://github.com/obi1kenobi/trustfall

Re:GraphQL Is a Trap? by pstuart on Friday May 06, 2022 @06:22PM (#31290178)
Starred and noted for a project I'm working on. Thanks!
Re:GraphQL Is a Trap? by Southland on Friday May 06, 2022 @05:44PM (#31289893)
This is super cool. Thanks for sharing