dropData endpoint missing on dgraph (not on slash)

Report a Dgraph Bug

What version of Dgraph are you using?

Dgraph Version
$ dgraph version
 
Dgraph version   : v21.03.1
Dgraph codename  : rocket-1
Dgraph SHA-256   : a00b73d583a720aa787171e43b4cb4dbbf75b38e522f66c9943ab2f0263007fe
Commit SHA-1     : ea1cb5f35
Commit timestamp : 2021-06-17 20:38:11 +0530
Branch           : HEAD
Go version       : go1.16.2
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

MacOS 16GB RAM

Steps to reproduce the issue (command/config used to run Dgraph).

Run this against the /admin API on dgraph/standalone:

mutation { 
  dropData(allDataAndSchema: true) {
    response { 
      code 
      message 
    } 
  } 
}

Expected behaviour and actual result.

I’d like to use the dropData(allDataAndSchema: true) mutation to programmatically truncate the data in my local test instance of dgraph after I push a new schema, however this endpoint seems to only exist in slash graphql.

Being able to do this programmatically would be a nice boost to local productivity.

Did you try both:

https://cerebro.cloud.dgraph.io/graphql

and

https://${DEPLOYMENT_URL}.cloud.dgraph.io/admin

(Login to Dgraph Cloud → GraphQL → GraphQL Endpoint → Admin)

DGraph renamed Slash Dgraph to Cloud Dgraph and didn’t update all the docs, so I suspect one of those two should work instead.


@MichelDiz

Docs that need to be updated:

J

No, sorry, I meant on a local instance of dgraph, not on a Cloud Dgraph instance.

Check the Schema. If you use any GraphQL client you should be able to see the Admin Schema and find out if that version supports this. If not, that means you may need to upgrade or the function was moved somewhere. The schema could clarify that.

Mmm yeah so I introspected the admin API’s graphql endpoint, and there’s no sign of ‘dropX’ in there…

Is there no way to do this in a local instance?

Go to Ratel, then go to Schema, then “Bulk edit” and then “drop data”.

But this is quite weird, it should have been in the community edition. @dmai do you have any idea why it seems to not have it?

Okay great, but yeah it would be ideal to be able to do this programmatically. At least in a standalone instance for testing purposes!

You can send a cURL command.

curl -s localhost:8080/alter -d '{ "drop_all": true }'

https://dgraph.io/docs/deploy/dgraph-administration/#secure-alter-operations

Nice. It looks like you guys updated the docs. There are still a few broken references (search slash in the docs and you can see what is left to change).

Thanks for getting this updated!

J

What exactly do you think was updated? That last doc ref is pretty old. BTW, this method will be discontinued in the future.

Nm. There are still references to Slash Dgraph. I didn’t know if that should be updated or not in the docs (from the two links above and if you search “slash” in the docs).

J