1

Is there a way to retrieve the dgraph schema using the dgo client?

What I want to do is compare my existing schema with the one on the server in order to avoid re-sending it as it triggers reindexing each time I send a schema which is already set.

Coyote
  • 2,454
  • 26
  • 47

1 Answers1

0

It is actually possible to retrieve information about the entires schema:

txn := client.NewTxn()
res, err := txn.Query(ctx, `schema{}`)
if err != nil {
    return err
}

for _, predicate := range res.GetSchema() {
    log.Printf("predicate: %#v ", predicate)
}
Coyote
  • 2,454
  • 26
  • 47