Dgraph database design for "schema on read" structure

Dgraph has two flavors, DQL and GraphQL. GraphQL is strict schema. What you are looking for is DQL which is loosely schema’d. When you insert/add data to the db using DQL the schema can be defined on the fly or auto detected based on first seen datatype, but it is not schemaless as there is an underlying schema. You then as an db admin decide what parts you want to index and how you want to index it to allow for better querability (some queries are not possible without defining an index).

You can use these two flavors simultaneously if you understand how they map to each other which allows for a strictly defined front end and a loosely defined backend for conglomorating data from various sources. You can also use DQL exclusively. But if you use GraphQL it is actually rewritten into DQL on the fly to query the underlying db. This rewriting is in the core functions of the db hence making Dgraph a GraphQL capable db at its core without qny additional layers/servers.

See my pinned post:

And more of what’s missing from the state of Dgraph here:

Additional Communities:

2 Likes