Drop all data from Dgraph

We can drop all data from Dgraph via Post curl request.

A. To drop all data and schema:

$ curl -X POST localhost:8080/alter -d ‘{“drop_all”: true}’

B. To drop all data only (keep schema):

$ curl -X POST localhost:8080/alter -d ‘{“drop_op”: “DATA”}’

  1. How I can drop all data via Ratel UI?
    A. Schema->BulkEdit->Drop All (Drop All data with schema)
    B. ? (Drop All data without schema) ? Is it possible?
  2. How I can do this via url endpoint?
    localhost:8080/alter - does not work
    A. ? (Drop All data with schema)
    B. ? (Drop All data without schema)
1 Like

Hi vladimir ! , if you want to drop all data from via Ratel UI you can go to Schema->BulkEdit->Drop All :wink:

1 Like

It’s work, but:

How I can drop all data via Ratel UI?

B. ? (Drop All data without schema) ? Is it possible?
How I can do this via url endpoint?
localhost:8080/alter - does not work

A. ? (Drop All data with schema)
B. ? (Drop All data without schema)

No, you can open a request in Ratel’s repo tho.

Not sure if it works via HTTP queries.

But
curl -X POST localhost:8080/alter -d ‘{“drop_op”: “DATA”}’
is post request or not?
And mutate is post request?
https://docs.dgraph.io/deploy/#delete-database
To drop all data, you could send a DropAll request via /alter endpoint.

Not sure what you mean. You’ve asked about doing this in Ratel. It can’t. The drop all func in bulk edit is a built-in thing. It just does “drop all” not “drop data”.

And you’ve asked about doing via URL endpoint. What exactly it means? via browser? via curl?
If it is via browser I think it can’t be done. If it is via curl, it should work as you described.

https://docs.dgraph.io/deploy/#delete-database
To drop all data, you could send a DropAll request via /alter endpoint.

I mean via the browser. I think the topic above about get request with endpoint via browser string or not?

This doesn’t work

http://localhost:8080/alter?drop_all=true

Yes, it doesn’t work :cold_sweat:
printscreen

The way to do the drop data operation over HTTP is via the POST request:

curl -X POST localhost:8080/alter -d '{"drop_op": "DATA"}'

We can add a way to do that in Ratel too. I’ve created a feature request:

4 Likes

Nope. Doesn’t work…
curl -X POST localhost:8080/alter -d ‘{“drop_op”: “DATA”}’
{“errors”:[{“message”:“while lexing '{drop_op: at line 1 column 0: Invalid schema. Unexpected '”,“extensions”:{“code”:“Error”}}]}curl: (3) [globbing] unmatched close brace/bracket in column 5

Hey @onkarbanerjee, please note to use correct " and '. Yours are quite different “ and ‘, therefore unrecognized by lexer.

Can you try retyping the command in case you are copy pasting it? Because if I try running

I get the same error. But if I rerun the command by typing I get the desired results.