Pydgraph client alter schema has no useful information in response

Report a Dgraph Client Bug

What Dgraph client (and version) are you using?

(put “x” in the box to select)

  • Dgo
  • PyDgraph
  • Dgraph4J
  • Dgraph-js
  • Dgraph-js-http
  • Dgraph.NET

Version: 21.03

What version of Dgraph are you using?

v22.0.1

Have you tried reproducing the issue with the latest release?

yes.

What is the hardware spec (RAM, OS)?

not related.

Steps to reproduce the issue (command/config used to run Dgraph).

I run the following code to alter a predicate:

import pydgraph
schema = 'test.pydgraph.name: string @index(exact) .'
op = pydgraph.Operation(schema=schema, run_in_background=True)
r = client. Alter(op)

Set “run_in_background=False” has the same result.

Then, using the rich library to inspect the response r to see if there is something useful to determine if the operation have succeeded.

from rich import inspect
inspect(r)
╭───────────────────────── <class 'api_pb2.Payload'> ──────────────────────────╮
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
│ │ <class 'api_pb2.Payload'>.__repr__ returned empty string                 │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│       Data = b''                                                             │
│ DESCRIPTOR = <google.protobuf.pyext._message.MessageDescriptor object at     │
│              0x7f0b30a53220>                                                 │
│ Extensions = AttributeError('Extensions')                                    │
╰──────────────────────────────────────────────────────────────────────────────╯

In the response, the only readable property is Data, but it has no data, i.e., b''.

Expected behaviour and actual result.

I also try to perform an equivalent alter request using curl in the command line,

curl -XPOST "localhost:8080/alter" --silent --data 'test.pydgraph.name: string @index(exact) .' | jq -C '.'

The return data is formatted as

{
  "data": {
    "code": "Success",
    "message": "Done"
  }
}

which tells me that the operation has been successfully done.
I think pydgraph should also contains such information in its response for alter, just like performing query (in json format).