How to import exported (json format) database with the mutation

I used an admin mutation to export database into the json format,
After export it give me the three json files.

Now I don’t know which file is need to be imported and how to import that file using the mutation script.

Welcome Mahesh.
I am assuming you fired the mutation as described at this link.

The export folder will typically contain the following:
(a) g01.json.gz: This is actual data, which you will use for imports later.
(b) g01.gql_schema.gz: This is the graphql schema. You can extract the contents and initialize a new dgraph instance using this schema.
© g01.schema.gz: This is a Dgraph format. You can choose to ignore it.

In a new Dgraph graphql instance:

  1. Initialize the graphql schema by a curl command using contents of the schema file (b)
    curl -X POST localhost:8080/admin/schema --data-binary '@g01.gql_schema'
  2. Fire the live loader as below. You can directly use the data file (a)
./dgraph live -f ./export/dgraph.r25.u0922.1137/g01.json.gz

Pass the data file with the -f argument. That should do it.

@anand Thanks for the instant support

Can we any option to import it using the dgraph mutation script?

1 Like

No, the exported data can only be imported via bulk or live loaders.

@anand Thank you very must for giving me the right direction.