DEV Community

Discussion on: GraphQL for PostgreSQL - Why?

Collapse
 
uminer profile image
Moshe Uminer

Agreed, if it is wrapping the database directly, as opposed to a service that might transform the database, I'm not sure how much it would add.

Thread Thread
 
benbot profile image
Benjamin Botwin • Edited

depending on the tools, you're not restricting the power of the DB, you're adding a thin and intelligent HTTP based layer on top of your DB.

Read into the docs (and code if you're into that) for postgraphile. They generate VERY efficient sql queries AND you can write query and mutation resolvers in postgresql so you maintain all the power of the database while getting a very nice graphql api to work with.

Another reason you may want a graphql layer on top of your DB would be for more control over your response payloads. You could get as little data as you need, which is a BIG win for mobile apps who's users have pretty small data caps.

Thread Thread
 
johanneslichtenberger profile image
Johannes Lichtenberger

Can you point me to the source where they generate the SQL queries?

Thread Thread
 
benbot profile image
Benjamin Botwin

I haven’t dug too deeply into postgraphile’s code, but I believe this is where they build their queries.

github.com/graphile/graphile-engin...