# Python primer test on dgraph

**URL:** <https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372>\
**Category:** Users\
**Created:** [March 26, 2018, 6:11am UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372 "2018-03-26T06:11:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeloo](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@joeloo](https://discuss.dgraph.io/u/joeloo)\
**Post date:** [March 26, 2018, 6:11am UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372/1 "2018-03-26T06:11:38Z")

</div>

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 🙂

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="")

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [March 26, 2018, 10:12pm UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372/2 "2018-03-26T22:12:09Z")

</div>

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

There is a pending PR for pydgraph at [Add Dgraph v1 support and make the interface compatible with other clients by gpahal · Pull Request #21 · dgraph-io/pydgraph · GitHub](https://github.com/dgraph-io/pydgraph/pull/21) which should be merged soon by @gpahal. The PR would also add examples.

---

<div class="post-metadata">

**Author:** ![joeloo](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@joeloo](https://discuss.dgraph.io/u/joeloo)\
**Post date:** [March 27, 2018, 4:11am UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372/3 "2018-03-27T04:11:22Z")

</div>

The example are taken from :  
[https://docs.dgraph.io/v0.8.3/clients/](https://docs.dgraph.io/v0.8.3/clients/)

Update on docs would be useful for new comers.

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [March 27, 2018, 10:42pm UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372/4 "2018-03-27T22:42:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [April 26, 2018, 10:42pm UTC](https://discuss.dgraph.io/t/python-primer-test-on-dgraph/2372/5 "2018-04-26T22:42:46Z")

</div>

Closed on April 26, 2018, 10:42pm UTC

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