I’ve been trying to get it to work and I can only get queries to work, with mutations I get a response back that has weird UIDS and nothing actually changes.
I am using pydgraph.DgraphClientStub.from_slash_endpoint to create a stub, including an API code. Been banging my head on this for a while and the docs are no help.
That did it! It created a new record, how do I tell it to update an existing record instead of creating a new one? For this particular type, I have no primary key, it’s simply one field that is used as a global app stage to know how far along it is.
Also, what does this output mean? Is this because I have no primary key (ID)?
When you run this, you will see a response similar to the one below.
uids {
key: "newNode"
value: "0x7"
}
We asked Dgraph to create a new node with the name newNode. The _:newNode is called a blank node. Dgraph reports the uid of the new node created. You can query for the node created using the uid function. The key you saw in your query’s response is an autogenerated id. You could use a blank node for clarity.
DQL does not enforce the concept of a primary key. If you want to search for a node and update, (and create the node if it does not exists), please review the upsert block example. Here is some more documentation. Please give this a try.