# Export schema

**URL:** <https://discuss.dgraph.io/t/export-schema/10089>\
**Category:** Dgraph\
**Tags:** kind:question, schema\
**Created:** [September 8, 2020, 8:13am UTC](https://discuss.dgraph.io/t/export-schema/10089 "2020-09-08T08:13:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![spinelsun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/spinelsun/32/4596_2.png) [@spinelsun](https://discuss.dgraph.io/u/spinelsun)\
**Post date:** [September 8, 2020, 8:13am UTC](https://discuss.dgraph.io/t/export-schema/10089/1 "2020-09-08T08:13:28Z")

</div>

Hi,

Is it possible to export or import a scheme that was created with Ratel?

Thanks,  
Or

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 8, 2020, 10:07am UTC](https://discuss.dgraph.io/t/export-schema/10089/2 "2020-09-08T10:07:27Z")

</div>

Hi @spinelsun,

Ratel Dashboard serves as UI for running mutations, queries and altering schema. To import/export schema, you can make graphql API requests to a running instance of Dgraph using any compatible client like Insomnia, GraphQL Playground or GraphiQL.

Importing:  
Suppose a schema is present in schema.graphql file and there is a Dgraph alpha serving at localhost:8080. The following request could be used to import schema.

```auto
curl -X POST localhost:8080/admin/schema --data-binary '@schema.graphql'

```

Reference: [https://dgraph.io/docs/graphql/todo-app-tutorial/todo-schema-design/#running](https://dgraph.io/docs/graphql/todo-app-tutorial/todo-schema-design/#running)

Exporting:  
To export schema, you can execute the following GraphQL mutation on /admin endpoint.  
More Details: [https://dgraph.io/docs/deploy/dgraph-administration/#exporting-database](https://dgraph.io/docs/deploy/dgraph-administration/#exporting-database) .  
Note that this will export the complete database to a directory. It will contain a compressed .gz file which will have schema in it.

---

<div class="post-metadata">

**Author:** ![spinelsun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/spinelsun/32/4596_2.png) [@spinelsun](https://discuss.dgraph.io/u/spinelsun)\
**Post date:** [September 8, 2020, 12:40pm UTC](https://discuss.dgraph.io/t/export-schema/10089/3 "2020-09-08T12:40:35Z")

</div>

> [@rajas](#):
>
> localhost:8080.

It would be nice to be able to export only the scheme from the database without its data.  
The data might be larger than what one computer can contain…

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 8, 2020, 2:11pm UTC](https://discuss.dgraph.io/t/export-schema/10089/4 "2020-09-08T14:11:40Z")

</div>

Its not possible to export only the schema using export mutation.  
However, you can query schema in Ratel itself as follows,

```auto
schema{
}

```

The output of this query will contain all types and predicates (the whole schema) in JSON.

---

<div class="post-metadata">

**Author:** ![spinelsun](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/spinelsun/32/4596_2.png) [@spinelsun](https://discuss.dgraph.io/u/spinelsun)\
**Post date:** [September 8, 2020, 2:20pm UTC](https://discuss.dgraph.io/t/export-schema/10089/5 "2020-09-08T14:20:08Z")

</div>

Ok thanks

still if you can develop an export scheme feature in Ratel under the Schema tab it will be a nice improvement.

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 8, 2020, 4:40pm UTC](https://discuss.dgraph.io/t/export-schema/10089/6 "2020-09-08T16:40:40Z")

</div>

Thanks for your feedback. We have noted this.

---

<div class="post-metadata">

**Author:** ![ashwin\_reddy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ashwin_reddy/32/8983_2.png) [@ashwin\_reddy](https://discuss.dgraph.io/u/ashwin_reddy)\
**Post date:** [October 19, 2021, 10:55am UTC](https://discuss.dgraph.io/t/export-schema/10089/8 "2021-10-19T10:55:14Z")

</div>

Is it possible to export data for a single type? and load back to the same type. whereas schema is the same for both.
