Using dgo to manage dgraph

I have used the to manage my schema. As I know the dgraph is also graphql database, so I try to connect it with a graphql client but the bellow error occurred:

Not resolving __schema. There's no GraphQL schema in Dgraph. Use the /admin API to add a GraphQL schema

My schema is already added using dql.

Adding just a DQL schema does not generate the GraphQL schema, but adding a GraphQL schema does gemerate the DQL schema.

For beginners, check this out: New to Dgraph? DQL vs. GraphQL, Endpoints, Headers, and Schema Translation

1 Like

Is there any way to convert the dql schema to graphql? For example if you have an old application using DQL, what would be the appropriately way to convert it to graphql ?

Give this a read:

Create your GraphQL schema and map to your existing DQL schema using the @dgraph directive.

1 Like

I did the graphql schema and now are available all the queries and mutation from graphql.

The issue I have now is that when I try to query some results from graphql nothing is returned. When I did a mutation from graphql client, these data are available to graphql. Do you have any idea?

Can you provide a snippet of you DQL schema, GraphQL schema, and a GraphQL query you are running with maybe a small dataset.

This will help debug where in this process is broken.

Also what version are you using?

update: I have found the issue. It was because i forgot to add the DType to the struct.

Thanks a lot for your help.

Dgraph version: v21.03.2

For the sake of clarity, I am just adding a part of my schema, because the problem I have still exists in the following small schema.

DQL schema:

<Product.created_at>: datetime .
<Product.image>: string .
<>: string @index(hash) @upsert .
<Product.slug>: string @index(hash) @upsert .
<Product.updated_at>: datetime .
<dgraph.drop.op>: string .
<dgraph.graphql.p_query>: string @index(sha256) .
<dgraph.graphql.schema>: string .
<dgraph.graphql.xid>: string @index(exact) @upsert .
type <Product> {
type <dgraph.graphql> {
type <dgraph.graphql.persisted_query> {

GraphQL schema:

type Product {
    id: ID!
    name: String! @id @dgraph(pred: "")
    slug: String! @id @dgraph(pred: "Product.slug")
    image: String @dgraph(pred: "Product.image")
    created_at: DateTime! @dgraph(pred: "Product.created_at")
    updated_at: DateTime! @dgraph(pred: "Product.updated_at")

Using the above schema, graphql queries are working fine.

Graphql mutation

mutation MyMutation {
  addProduct(input: {name: "product 1", slug: "prod-1", created_at: "2021-10-04T06:37:57.707227339Z", updated_at: "2021-10-04T06:37:57.707227339Z"}) {

Graphql Query

query MyQuery {
  queryProduct {

response of the graphql query:

  "data": {
    "queryProduct": [
        "name": "product 1"
  "extensions": {
    "touched_uids": 2,
    "tracing": {
      "version": 1,
      "startTime": "2021-10-04T06:42:01.064395081Z",
      "endTime": "2021-10-04T06:42:01.065675778Z",
      "duration": 1280687,
      "execution": {
        "resolvers": [
            "path": [
            "parentType": "Query",
            "fieldName": "queryProduct",
            "returnType": "[Product]",
            "startOffset": 110469,
            "duration": 1164739,
            "dgraph": [
                "label": "query",
                "startOffset": 149859,
                "duration": 1123999

Then I did a mutation using dgo: and the data are shown fine using the ratel tool. When I try again the Graphql Query:

query MyQuery {
  queryProduct {

none of these data added by dgo are returned in the graphql response.

1 Like