# Using pydgraph w/ slash

**URL:** <https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231>\
**Category:** Dgraph Cloud\
**Tags:** kind:question\
**Created:** [January 10, 2021, 1:21am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231 "2021-01-10T01:21:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![billybobthorton](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@billybobthorton](https://discuss.dgraph.io/u/billybobthorton)\
**Post date:** [January 10, 2021, 1:21am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/1 "2021-01-10T01:21:25Z")

</div>

I am trying to use pydgraph w/ slash graphql as that seems the only way to get atomic transactions and when I do `client_stub = pydgraph.DgraphClientStub('localhost:9080')` using my slash graphql address, i get a DNS error `details = "DNS resolution failed for service` for the url when doing a query.

Is there any tutorials or walkthroughs for using slashql w/ pydgraph or even better how to do atomic transactions w/ slash graphql. The documentation for the official client is very limited, there is also no talk about using authenticated queries with it, I assume you pass the metadata argument. There is mention of using headers, but only with alter calls, and there is mention of passing credentials, but no mention what they should look like.

Update:

I did find `pydgraph.DgraphClientStub.from_slash_endpoint` for using a slashql endpoint in a different area but not in that repo’s documentation. Still could use examples. For example, when trying to do a mutation, I get errors that the ‘Schema not defined for predicate’, and I have to use the type.field notation, but in the examples, it does not do this, I only found this digging in other documentation. But I have yet to figure out how to get mutations to work, I managed to avoid error messages but it isn’t updating my instance db.

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [January 11, 2021, 12:42am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/2 "2021-01-11T00:42:40Z")

</div>

[@docs](https://discuss.dgraph.io/groups/docs) , is there some bandwidth for some pydgraph love?

@martinmr / @anurag do we support atomic txn in pydgraph? I wasn’t aware we are.

---

<div class="post-metadata">

**Author:** ![billybobthorton](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@billybobthorton](https://discuss.dgraph.io/u/billybobthorton)\
**Post date:** [January 11, 2021, 12:56am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/3 "2021-01-11T00:56:42Z")

</div>

I did see Transactions and Commits on the brief docs, so I only assume it supports atomic operations, but I can’t get it to do mutations in general.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [January 11, 2021, 1:54am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/4 "2021-01-11T01:54:11Z")

</div>

One point to notice. None of Dgraph’s clients are made to run GraphQL(maybe in the future we could have one, but there are out there really good ones). Feels like you wanna do DQL queries and transactions. Following this docs [Advanced Queries with DQL - Dgraphcloud](https://dgraph.io/docs/slash-graphql/advanced-queries/), it shows that is possible to do with cURL. Therefore it is perfectly capable of being used in the Py client (for DQL).

> [@billybobthorton](#):
>
> ‘localhost:9080’

I believe that any Dgraph service doesn’t expose that port. Not sure, I think that all will run at `80`.

* * *

[@docs](https://discuss.dgraph.io/groups/docs) and @gja - This docs feels odd. It opens a connection in the GraphQL subpath. Which confuses me.

```auto
client_stub = pydgraph.DgraphClientStub.from_slash_endpoint("https://frozen-mango-42.eu-central-1.aws.cloud.dgraph.io/graphql", "<api-key>")

```

Why a DQL query would run in a GraphQL subpath? The previous part of the docs mention that we have `/query`, `/graphql`, `/mutate` and `/commit` endpoints.

Also in the Ratel part mention that it should connect to the `/graphql` subpath. This would make the user think that Ratel supports GraphQL.

---

<div class="post-metadata">

**Author:** ![gja](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/gja/32/2654_2.png) [@gja](https://discuss.dgraph.io/u/gja)\
**Post date:** [January 12, 2021, 8:20am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/5 "2021-01-12T08:20:07Z")

</div>

The various clients take the endpoint as it’s given on Slash GraphQL interface. Technically, everything except for the hostname is simply ignored over there.

---

<div class="post-metadata">

**Author:** ![billybobthorton](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@billybobthorton](https://discuss.dgraph.io/u/billybobthorton)\
**Post date:** [January 12, 2021, 8:30am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/6 "2021-01-12T08:30:15Z")

</div>

yeah I figured that out, but this was the key thing to get it to work ‘from\_slash\_endpoint()’, it wasn’t in the Pydgraph docs though, I found it in the DQL docs. I also ran into some other issues.

---

<div class="post-metadata">

**Author:** ![gja](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/gja/32/2654_2.png) [@gja](https://discuss.dgraph.io/u/gja)\
**Post date:** [January 12, 2021, 8:32am UTC](https://discuss.dgraph.io/t/using-pydgraph-w-slash/12231/7 "2021-01-12T08:32:21Z")

</div>

Thanks, i’ll put this in the various clients. Currently, they are in the Slash GraphQL docs, but it makes sense to put it in the individual clients.
