Is GraphQL an ORM?

Viewed 6625

Is GraphQL an ORM? It seems like it is. At the end of the day it needs to query the database for information. You need to give it a schema (just like an ORM). From my understanding, on the front end you pass it the specifics that you want and GraphQL on the back end will give you just the info you requested.

The only difference I see from traditional ORMs, such as Sequelize or ActiveRecord, is that GraphQL will give you only what you want, making it very attractive and flexible. I suspect though that whatever's going on under the hood may leave you with some inefficient queries (common to ORMs). So is GraphQL simply an ORM that gives you 100% flexibility in what you ask for and receive?

3 Answers

No it's not. With only GraphQL, we can't access the database easily, because the language needed to send query isn't mapped by an ORM.

ORM makes it easy to access a database, which is in a sense is more like creating a virtual database which our programming language can easily access. Then GraphQL send its query into that virtual database.

I recommend you Prisma. Prisma is a performant open-source GraphQL ORM-like layer doing the heavy lifting in your GraphQL server. It turns your database into a GraphQL API which can be consumed by your resolvers via GraphQL bindings.

Related