vladimir
(vladimir)
January 21, 2020, 8:54am
1
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”}’
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?
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
1 Like
vladimir
(vladimir)
January 21, 2020, 9:52am
3
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)
MichelDiz
(Michel Diz)
January 21, 2020, 3:52pm
4
No, you can open a request in Ratel’s repo tho.
Not sure if it works via HTTP queries.
vladimir
(vladimir)
January 21, 2020, 7:18pm
5
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.
MichelDiz
(Michel Diz)
January 21, 2020, 8:08pm
6
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.
vladimir
(vladimir)
January 21, 2020, 9:19pm
7
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?
MichelDiz
(Michel Diz)
January 21, 2020, 11:34pm
8
This doesn’t work
http://localhost:8080/alter?drop_all=true
dmai
(Daniel Mai)
January 24, 2020, 7:27pm
10
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:
https://github.com/dgraph-io/ratel/issues/159
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
Naman
(Naman Jain)
July 9, 2020, 9:28am
12
Hey @onkarbanerjee , please note to use correct " and '. Yours are quite different “ and ‘, therefore unrecognized by lexer.
Naman
(Naman Jain)
July 9, 2020, 10:21am
14
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.
bkennedy
(William Kennedy)
January 31, 2021, 4:47pm
16
After upgrading to the lastest version of standalone:master my tests are now failing.
query:
{"drop_op": "DATA"}graphql error:
while lexing {"drop_op": "DATA"} at line 1 column 1: Invalid schema. Unexpected "
This code was working
query := strings.NewReader(`{"drop_op": "DATA"}`)
Raw Message:
*****graphql*******>
{"drop_op": "DATA"}
{"errors":[{"message":"while lexing {\"drop_op\": \"DATA\"} at line 1 column 1: Invalid schema. Unexpected \"","extensions":{"code":"Error"}}]}
Any thoughts?
MichelDiz
(Michel Diz)
January 31, 2021, 6:14pm
17
With dgo it should be like
op := api.Operation{drop_op: "DATA"}
bkennedy
(William Kennedy)
January 31, 2021, 7:11pm
18
Thanks for the response. I am making a raw graphql call over HTTP and this was working until I downloaded the latest version of master
MichelDiz
(Michel Diz)
January 31, 2021, 7:35pm
19
weird, cuz nothing was changed in that matter. Also I have tested locally and
curl -X POST localhost:8080/alter -d '{"drop_op": "DATA"}'
is working fine.
BTW, in the future, all HTTP calls might be deprecated. It seems that all of them will be at the GraphQL admin.
bkennedy
(William Kennedy)
January 31, 2021, 7:58pm
20
I am making this call using /alter and I need this to exist for running tests.
dgraph/standalone master 69d0f682a33c 39 hours ago 166MB
MichelDiz
(Michel Diz)
January 31, 2021, 8:07pm
21
Have you tried a manual cURL?