Dgraph for SQL Pros workshop on 6/10 - Free Signup
To optimize your experience, the interactive tutorial is only available on desktop.

Dgraph GraphQL Tour

Basic

Graphs as results

The last query returned some data, but the result wasn’t very interesting, nor did it teach us much about graphs.

In Dgraph and GraphQL, queries return graphs, not tables or lists of data.

A query is executed against a graph and the result is a subset of the queried graph.

Let’s improve the query to return Alice, along with her network of friends. Run the query to see the results.

In the results you will notice that the graph contains the age of Alice, but does not include the age of any of Alice’s friends. This is because we only requested this field for Alice and not on the nodes found on the friends edge.

Something to try: Alice also owns a pet, find it and its name. The ownsPets edge can help you here.