Pydgraph LocalError: unknown service graph.Dgraph

I use the pydgraph code bellow to query dgraph(VERSION=0.7.4) , then it fails.
when use curl to query the same content, it’s OK.

In [1]: from pydgraph.client import DgraphClient
In [2]: pydgraph.client.__version__
Out[1]: '0.3.5'
In [3]: dg_client = DgraphClient('localhost', 8080)
In [4]: response = dg_client.query("""
                <alice> <name> \"Alice\" .
                <greg> <name> \"Greg\" .
                <alice> <follows> <greg> .

The error is look like this:

LocalError                                Traceback (most recent call last)
<ipython-input-14-22802b274334> in <module>()
      9             }
     10         }
---> 11         """)

/home/app/caizb/venv/local/lib/python2.7/site-packages/pydgraph/client.pyc in query(self, q, timeout)
     36     def query(self, q, timeout=None):
     37         request = graphresponse_pb2.Request(query=q)
---> 38         response = self.stub.Query(request, timeout)
     39         return response

/home/app/caizb/venv/local/lib/python2.7/site-packages/grpc/beta/_client_adaptations.pyc in __call__(self, request, timeout, metadata, with_call, protocol_options)
    298         self._channel, self._group, self._method, timeout, with_call,
    299         protocol_options, metadata, self._metadata_transformer, request,
--> 300         self._request_serializer, self._response_deserializer)
    302   def future(self, request, timeout, metadata=None, protocol_options=None):

/home/app/caizb/venv/local/lib/python2.7/site-packages/grpc/beta/_client_adaptations.pyc in _blocking_unary_unary(channel, group, method, timeout, with_call, protocol_options, metadata, metadata_transformer, request, request_serializer, response_deserializer)
    196           credentials=_credentials(protocol_options))
    197   except grpc.RpcError as rpc_error_call:
--> 198     raise _abortion_error(rpc_error_call)

LocalError: LocalError(code=StatusCode.UNIMPLEMENTED, details="unknown service graph.Dgraph")

I had the same issue when I tried to use the java client, you have to regenerate the code of the service from the protos, you need the graphresponse.proto and facets.proto, after that you have to update the client code to use the Run service instead of Query, the last one is not longer available.

The clients (python and java) are a little abandoned, maybe in a future the clients could be maintained by dgraph team.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.