# Deleting predicate from schema

**URL:** <https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572>\
**Category:** Users\
**Created:** [June 23, 2017, 4:33pm UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572 "2017-06-23T16:33:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamethecomplex](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/tamethecomplex/32/496_2.png) [@tamethecomplex](https://discuss.dgraph.io/u/tamethecomplex)\
**Post date:** [June 23, 2017, 4:33pm UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/1 "2017-06-23T16:33:10Z")

</div>

Sorry if this question is overly basic…I’m just getting started with GraphQL±.

I would like to delete all of these predicates from my schema:

```auto
{  
   "schema":[  
      {  
         "predicate":"name",
         "type":"string"
      },
      {  
         "predicate":"revenue",
         "type":"float"
      },
      {  
         "predicate":"starring",
         "type":"uid"
      },
      {  
         "predicate":"release_date",
         "type":"date",
         "index":true,
         "tokenizer":[  
            "date"
         ]
      },
      {  
         "predicate":"planet",
         "type":"string"
      },
      {  
         "predicate":"director",
         "type":"uid"
      },
      {  
         "predicate":"friend",
         "type":"uid"
      },
      {  
         "predicate":"student",
         "type":"uid"
      },
   ]
}

```

I tried running a few variations of the “delete” syntax, for example:

```auto
mutation {
  delete {
    <planet> * * .
  }
}

```

But haven’t been successful in deleting the schema predicates. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![michaelcompton](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/michaelcompton/32/1774_2.png) [@michaelcompton](https://discuss.dgraph.io/u/michaelcompton)\
**Post date:** [June 26, 2017, 12:00am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/2 "2017-06-26T00:00:26Z")

</div>

Do you want to delete everything and start over? To do that, stop dgraph, wait till it’s finished exiting, remove the p and w dirs and restart.

---

<div class="post-metadata">

**Author:** ![tamethecomplex](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/tamethecomplex/32/496_2.png) [@tamethecomplex](https://discuss.dgraph.io/u/tamethecomplex)\
**Post date:** [June 26, 2017, 12:42am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/3 "2017-06-26T00:42:35Z")

</div>

In this case yes that will work 🙂 I could see needing to clear out unused schema in the future, but in my case I don’t have much data to lose. Thanks!

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 26, 2017, 4:23am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/4 "2017-06-26T04:23:44Z")

</div>

> [@tamethecomplex](#):
>
> mutation {  
> delete {  
> \<planet\> \* \* .  
> }  
> }

It should have been `* <planet> *`. The predicate is the middle one.

---

<div class="post-metadata">

**Author:** ![tamethecomplex](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/tamethecomplex/32/496_2.png) [@tamethecomplex](https://discuss.dgraph.io/u/tamethecomplex)\
**Post date:** [June 26, 2017, 11:21am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/5 "2017-06-26T11:21:41Z")

</div>

Thanks @mrjn. When I try that though I get this error:

```auto
{"code":"Error","message":"'*' only allowed at predicate/object in del mutations"}

```

Also, if this statement were to work, would it delete all matching quads (data) only, or also the associated schema entry for the predicate? Basically I am looking for the **delete** operation which would negate this schema definition statement:

```auto
mutation {
  schema {
    planet: string .
  }
}

```

---

<div class="post-metadata">

**Author:** ![mrjn](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mrjn/32/775_2.png) [@mrjn](https://discuss.dgraph.io/u/mrjn)\
**Post date:** [June 27, 2017, 8:46am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/6 "2017-06-27T08:46:22Z")

</div>

I thought this deletion feature was already there. But, @pawan just pushed this y’day. So, you can expect this in v0.8. Until then, you will have to stop Dgraph, and clear out the underlying directories.

---

<div class="post-metadata">

**Author:** ![pawan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pawan/32/1946_2.png) [@pawan](https://discuss.dgraph.io/u/pawan)\
**Post date:** [June 30, 2017, 7:01am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/7 "2017-06-30T07:01:01Z")

</div>

Hi @tamethecomplex

This was pushed to master a couple of days ago and will go in the next release. You could `go get` the master build and try this feature out in the meantime.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [July 30, 2017, 7:01am UTC](https://discuss.dgraph.io/t/deleting-predicate-from-schema/1572/8 "2017-07-30T07:01:11Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
