dgraph-io / dgraph-io/dgraph

[FEATURE]: DQL Not Null Constraint (Existential)

Open
#8,409 3 comments 1 reaction 1 assignee View on GitHub

@shiva-istari is already working on this.

Since Jun 9, 2026.

area/dql-graphql-interop community kind/feature Stale
Dominant language
Go
Stars
21.8k
Forks
1.6k
Avg merge
2d 5h
Merged PRs (30d)
9

Description

Have you tried Dgraph before this proposal? and did not find anything similar?

No response

What you wanted to do.

Enforce that a value exists in a node in DQL.

Perhaps on the DQL schema:

type Person {
  friend @notnull
  ...
}

I should not be able to alter the schema where non null values exist.

What you actually did.

You can do this now in GraphQL with the ! in front of the type. See here.

We need to be able to do this in DQL.

Why wasn't it great, with examples.

You can add data in DQL, ignoring the GraphQL constraint, causing data integrity issues. It should be IMPOSSIBLE to have null data if this constraint is actie.

Additional information.

How neo4j handles it.
How sql handles it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.