Export schema

Hi,

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

Thanks,
Or

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.

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

Reference: 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 .
Note that this will export the complete database to a directory. It will contain a compressed .gz file which will have schema in it.

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…

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

schema{
}

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

Ok thanks

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

Thanks for your feedback. We have noted this.