Best Practice when developing schemas GraphQL First or DQL First?

Noobie here. I’d like to know when I’m designing my schema, whether it is better to design against GraphQL first or design it against DQL first then add the GraphQL schema. From the docs and my limited experience it seems like I should build out using DQL first and then add the GraphQL schema to reference DQL predicates when necessary.

Love to hear what your opinion is on this topic.

Thanks!
KoderGuy

If you want freedom, use DQL.
If you want safety, but hard typed. Use GraphQL.

If you start in GraphQL you will be limited to the GraphQL spec. If you use DQL and don’t respect GraphQL modeling, you will have difficulty using GraphQL in the future. But migration is possible.

If you don’t want GraphQL, it doesn’t make sense to model via GraphQL.

If you’re a new in both, I would recommend picking up a language and sticky to it. Only then do you venture to mix things up. Once you fully understand the GraphQL spec and the DQL language. Learning one of the two will be easy to learn one or the other later because they are similar. But DQL is a free language, created to perform operations on Database. GraphQL, on the other hand, is agnostic, not designed for Databases. We’ve created a kind of framework that ties Dgraph together and adds CRUD for you automatically.

Hi Richard, choosing between GraphQL or DQL is basically driven by your main use case.
Dgraph can be used by application developers leveraging the flexibility of GraphQL. Dgraph will speed up the dev process and offer very good performance and scalability for the app as it automatically generates both the API and the graph backend from a GraphQL schema. If you know GraphQL, your learning curve is very short.

Dgraph can also be used by data engineers doing more sophisticated graph manipulations (pattern matching, threat detection, recommendation engine, etc …) where they need to be able to navigate a knowledge graph. DQL is the query language that will expose all the graph details. The learning curve is steeper.

If you are an app developer starts with GraphQL.

You can always use DQL even if you started with GraphQL. DQL can access all the nodes and relationships created by GraphQL approach !

We are working at making GraphQL and DQL interoperability simpler to serve the use cases where you want both a rapid app and some complex logic involving graph algorithms.

Feel free to share your use cases and what you want to achieve to have better advice from the community.

1 Like

Here is a blog about this exact question:

2 Likes

Thank you to everyone who replied! Your advice has really helped me deciding which way to go in my app dev.

Greatly Appreciated!

1 Like