Drop all in a multi-tenant DGraph

Hi, I have a Dgraph Cloud shared instance, that I load programatically via a Go program. I am trying to drop all data within my namespace. The cloud UI can do this easily via the Drop Data button within the schema tab.

If i run an api.Operation{DropOp: api.Operation_DATA} in dgo I get "rpc error: code = PermissionDenied desc = Drop all can only be called by the guardian of the galaxy. Only guardian of galaxy is allowed to do this operation"

Looking at the docs here it seems that is to be expected. How is the UI achieving this then? Must I manually loop through all predicates and types?

1 Like

For shared backends, drop all is not supported directly. For dropping the data and types, you’d need to call alter with '{"drop_op": "ATTR", "drop_value": "counter.val"}' for each predicate and type you want to drop.

In Dgraph Cloud, there’s an API to do this in a single API call (the same API the UI uses).

2 Likes

Thanks @dmai had some issues getting this working from go code (not curl) but its ok now. I notice allData works, but allDataAndSchema throws a “Failed to delete data” error, is this expected also in shared backends?

1 Like

That’s correct. It is not supported in shared backends. You can drop each predicate individually from your schema.

2 Likes