In the custom DQL example, the DQL query explicitly defines the fields to return for each tweet.
However, we may wish to use this custom logic in multiple contexts which require a different set of fields. Since the GraphQL query will define the fields required, there should be a way for the DQL query to defer field selection to the GraphQL query.
This should still be possible as in your GraphQL query you can only ask for fields that you want. Then even though everything would be requested in the DQL query, you’d only get the fields you desire.
We can look into supporting something like this. This would require merging the GraphQL and DQL query. Adding this to our list of things to things to look at.
I thought about this, but it’d require manually defining all possible DQL fields which would be brittle (in case you add or remove possible fields). Also, I assume the DQL query with all the fields would be inefficient since all edges would need to be traversed.
The defer functionality I mentioned above is one of the reasons the neo4j-graphql-js cypher directive is so powerful.
How do you envision something like that to work with what we have? Can you give some examples of the kind of queries you’d like to do and which parts would you like to defer to GraphQL±?
I’ll be looking into the improvements that we can make for DQL support in GraphQL and will be creating an RFC about it next week. I’ll also add this in there and have a plan of action for this soon.
Unfortunately, this won’t make it to 20.11. Other features were prioritized over improvements to Custom DQL. We will look into this again while planning for the next quarter.