Why does custom dql not support mutation?

I want to delete through custom dql:

type Mutation {
    deleteEntityById(id: String!): Entity @custom(dql: """
      upsert {
        query q($id: string) {
          E as var(func: type(Entity)) @filter(eq(Entity.id, $id)) {
            U as Entity.urls
            M as Entity.medias
        mutation {
          delete {
            uid(E) * * .
            uid(U) * * .
            uid(M) * * .

But when I update the schema, I receive an error message:

@custom directive with `dql` can be used only on queries

I hope custom dql can support all dql features, not limited to query.

I suspect that allowing mutations via @custom would cause a lot of headaches - your graphql code will no longer be deterministic.

But I think @pawan might be the best person to answer this and perhaps offer some discussions around it.

The dql has many features that the GraphQL API cannot do. If custom dql does not support mutation, it will bring a lot of difficulties and even have to give up the GraphQL API.

Can you please explain your use case, may be there is some other way to achieve that?

The initial aim for adding custom DQL was just to give you the ability to perform complex DQL queries like aggregations, multiple var blocks and such. We didn’t support custom DQL mutations for the sake of simplification but we can definitely do that.

Infact, you could right now define a GraphQL query which ultimately does a DQL upsert and that would work. We will be looking into supporting this as well.