Hacker News new | comments | show | ask | jobs | submit login

I like USING GraphQL (for existing services), like Github's API.

However, 99% of the tutorials on graphql , this one included, fail to show a real life use case. What I mean by that is a working Example of a SQL database from start to finish.

So this tutorial was very cool, but not very useful. Just like the rest of them.

I've yet to find a recent tutorial that covers full stack node.js + PostgreSQL/MySQL + whatever front end. It's always MongoDB or only covers the concepts of GraphQL.




This is a problem. It’s shocking people blow off not including that part. The current ORM’s out there kind of suck. I have been building a production app for a couple months now and that has been the biggest annoyance.

I have gotten by using eager loaded relationships and facebook’s dataloader to prevent n+1 query problems. Overall, I have found minimal extra queries.

At the same time, I wish I could devote time to make an orm that works like facebook’s dataloader. It would be so awesome. In fact I might try to do something like it myself. Inside of the user resolver on a post, just return Model.eager(“user”) and have it wait to resolve on the next tick. This would get us to a perfect world with node and graphql!!


The problem with using a relational database with GraphQL seems like you need to solve the object relational mismatch. I think in that case you'd be better off writing a library for parsing SQL then putting a secure layer over it that limits what SQL is allowed.

Ideally, you'd be able to just handle these security issues with the database directly through views and permissions, but as far as I know there is no database with enough permissions controls for this.


What about using GraphQL implies that you're trying to map objects from the database? As far as I know you can just query for the fields you want (with whatever joins you might need, or subqueries, or calls out to some other system) and return them to the client.


It's doing object mapping because it is coercing everything into JSON. Looking at the language, you see the usual suspects of strange cyclic objects for representing relations typical of ORMs. These systems tend to struggle when dealing with things like many to many relationships, non-total relations, etc. To give it credit though, I do like that GraphQL forces a firm separation between remote and local data, though I'm sure there are already libraries for GraphQL trampling over that separation.


there is, PostgreSQL https://blog.2ndquadrant.com/application-users-vs-row-level-...

(and saying GraphQL can't work with databases I think is wrong, it's the same as saying OO languages are not a good fit for relational databases)


Thanks for the info!




Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: