Python primer test on dgraph

Ok so i got the dgraph setup in an AWS test instance and ratel working fine connecting to it.
I wrote a simple python script and referred to the easiest example i can find :slight_smile:

from pydgraph.client import DgraphClient

g_Host = “13.250.197.28”

def AddData () :

dg_client = DgraphClient(g_Host, 8080)

response = dg_client.query("""mutation
    {
        set
        {
            <alice> <name> \"Alice\" .
            <greg> <name> \"Greg\" .
            <alice> <follows> <greg> .
        }
    }

    query
    {
        me(_xid_: alice)
        {
            follows
            {
                name _xid_
            }
        }
    }
    """)

print(response)

if name == “main” :
AddData()

—> But it gave an error and i do not know how to proceed from here

grpc.framework.interfaces.face.face.AbortionError: AbortionError(code=StatusCode.UNAVAILABLE, details="")

This example would not work as query and mutation need to be separate operations.

There is a pending PR for pydgraph at https://github.com/dgraph-io/pydgraph/pull/21 which should be merged soon by @gpahal. The PR would also add examples.

The example are taken from :
https://docs.dgraph.io/v0.8.3/clients/

Update on docs would be useful for new comers.

Sure, once the PR is merged we will update the docs here as well.

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