If Dgraph schema first , why it allows to insert data without schema definition?

As per Dgraph , it’s a schema-first database.
Here I can see in the tutorial, we can create data in dgraph without defining any schema Learn Dgraph in 20 minutes (Graph Database) quick tutorial - YouTube

The way I understand schema first is, that without a schema in place we create any data. Could you please help me to clear my understanding here?

This is one of the confusing things about Dgraph. If you interact via DQL there is no typesafety, only when you interact with the database via GraphQL is the schema enforced. So DQL is a dangerous tool like using raw SQL, so you really need to know exactly what you’re doing when you’re using and make sure you don’t modify your data so it no longer makes sense given your schema.

There are a few gotchas related to this too—when using hasInverse in GraphQL schema, the reverse edges are created automatically, however, if using DQL this won’t happen so you will need to make sure you always create the reverse edges.

1 Like