Moved from GitHub pydgraph/13
Posted by Aurora81:
I use the 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("""
mutation
{
set
{
<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)
301
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)
199
200
LocalError: LocalError(code=StatusCode.UNIMPLEMENTED, details="unknown service graph.Dgraph")