Pydgraph simple.py example failing partially/strangely

I’ve used dgraph on and off for a while and love it, but I am having the damndest time trying to get Pydgraph to work. If I run simple.py (pydgraph/simple.py at master · dgraph-io/pydgraph · GitHub), I get:
Error: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNKNOWN
details = “Expected scalar type inside . Got: [uid] for attr: [friend].”
debug_error_string = “{“created”:”@1570968454.611000000",“description”:“Error received from peer ipv6:[::1]:9080”,“file”:“src/core/lib/surface/call.cc”,“file_line”:1055,“grpc_message”:“Expected scalar type inside . Got: [uid] for attr: [friend].”,“grpc_status”:2}"

The error originates in the create_data method, but the drop_all and set_schema methods work perfectly.

Similarly, if I am running the code in a Jupyter notebook (in an attempt to debug), drop_all and set_schema work correctly, but if I run create_data, I get the error:
_Rendezvous: <_Rendezvous of RPC that terminated with: status = StatusCode.UNKNOWN details = “Empty query” debug_error_string = “{“created”:”@1570968964.441000000",“description”:“Error received from peer ipv6:[::1]:9080”,“file”:“src/core/lib/surface/call.cc”,“file_line”:1055,“grpc_message”:“Empty query”,“grpc_status”:2}" >

Any advice would be much appreciated.

Dgraph: 1.0.16
Python: 3.7

Thanks,
Ben

If you are using a latest version of py client, you should be using the latest version of Dgraph.

I switched over to the latest Docker Image and am now getting when running simple.py:
Error: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNKNOWN
details = “line 9 column 12: Missing colon in type declaration. Got
"
debug_error_string = “{“created”:”@1570992349.788012800”,“description”:“Error received from peer ipv4:127.0.0.1:9080”,“file”:“src/core/lib/surface/call.cc”,“file_line”:1055,“grpc_message”:“line 9 column 12: Missing colon in type declaration. Got \n”,“grpc_status”:2}"

If I eliminate from set_schema, it creates a simpler schema successfully:
type Person {
name
friend
age
married
loc
dob
}

Perhaps the mutation query is malformed for 1.1.0?

Thanks,
Ben

Are you following this? https://docs.dgraph.io/query-language/#type-system

Before jump from an old Dgraph version, read this:
https://blog.dgraph.io/post/release-v1.1.0/ .
https://docs.dgraph.io/howto/#migrate-to-dgraph-v1-1
https://docs.dgraph.io/deploy/#upgrade-database

Hi @bch132! I’ve also had starting problems with Pydgraph. Maybe it’s not bad a bad idea to start with normal (read) queries first. For this purpose you can import data using ratel and then run queries using the examples here. On the docs-page of dgraph you can find the code for each client - also for python. Here an example:

Then, step-by-step, you can do more advanced queries, mutations etc.

Cheers!

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