DQL with Apollo Client

Hi dgraph hivemind,

DQL cannot be used with Apollo Client, is that right?

My readings suggest that it wouldn’t work.
The references/examples within dgraph community are usually mentioning Apollo Client in combination with GraphQL. I can’t imagine how Apollo Cache would work with DQL given that it seems to parse the request to map them to cached results.
On the other hand, I just came across this @custom that shook me… altho as I was reading more about it… and realized that maybe it has completely another purpose, and it wouldn’t be something that I can just put together on a client to fake a GraphQL request which in fact is wrapping a DQL one… seems like it would need to be declared on the schema definition on a server-side. Even if would be a wrapping I could do on the client, it doesn’t seem to make sense that Apollo would be able to understand/parse this query anyhow.

Before the answers go too far from the question, I’d share some extra context.
I already have a client that sends DQL to a backend. I’m just looking to replace what exists with another piece of software that handles more FE features such as, for example, optimistic responses. In reality, what I’d like to replace for simply doesn’t exist yet… I need a reactive state manager that syncs with the Dgraph cluster. I saw a discussion about GraphQLite which goes towards what I’m looking for, but it looks multiple years away.
Therefore, I’m looking at Apollo as a first step and also as a learning/stepping stone for building something else.

DQL will never work with Apollo cuz Apollo is GraphQL only.

Yes, any GraphQL client should work with Dgraph’s GraphQL feature.

It wouldn’t at all. Apollo works with GraphQL only.

Yeah, that’s the solution to use DQL in a GraphQL context.

Custom queries are declared in the Schema itself.

Are you using DQL from a client? Like an actual client on the web and not another backend?

DQL should only be Server → Dgraph as it is very susceptible to injection

Hi Anthony,
Yes, we do receive DQL from a web client. Direct DQL queries from the web.
I appreciate the concern. Thank you for the input.

I read your article with this opinion before, however, I would argue that like most things in software engineering, it depends. I think it is helpful for many readers, as it speaks to users that are using out-of-the-shelf solutions. It just might not apply to some others. To maybe bring some extra clarity with an allegoric example, think that it is possible at this age to build SQL queries on a web client, press “run”, and get results, e.g. Google BigQuery or Tableau.

Finally, it isn’t a concern for our team. We don’t directly push those DQL messages to a Dgraph host, we communicate with a backend application that proxy those requests, doing multiple things while the message is being proxied.
This thread isn’t meant to talk about this tho, thus if you are curious about further details, I’d suggest engaging in this conversation and asking any questions you would like.