Ask a Question

Export data from Dgraph Cloud

As an Administrator you can export data from a Dgraph Cloud shared instance or dedicated instance. On a dedicated instance with multi-tenancy feature enabled you can export data across the cluster, or a specific namespace depending on the type of administrative privileges you have.

Exporting data from Dgraph Cloud using the console

  1. In the Admin section of the Dgraph Cloud console, go to Settings.
  2. In the Exports tab, click Create Export.
  3. In the New export dialog, select the format you want to export.
  4. Click Create.

Depending on the format that you chose to create an export, three files are generated.

Note Ensure that you download these files as soon as possible because the links to download these files expire after 48 hours from the time they were generated.

Exporting data from Dgraph Cloud using a GraphQL client

  1. Generate API Key for authentication.

  2. Make a note of the GraphQL endpoint for the instance from Overview in the Dgraph Cloud console. Replace /graphql with /admin/slashin the GraphQL endpoint to get the <ADMIN_ENDPOINT>.

  3. Authenticate the admin API requests by adding the <APIKEY> as the Dg-Auth header to every HTTP request.

  4. To export data you need to send authenticated request to <ADMIN_ENDPOINT>.

  5. Export data in JSON or RDF <FORMAT> using this mutation:

    mutation {
      export(format:"<FORMAT>") {
        response {
          message
          code
        }
        exportId
        taskId
     }
    }
    

    A response similar to this appears:

        "data": {
           "export":"exports/2011-12-08/0x18986fd-558223708",
           "response": {
              "code": "Success",
              "message": "Export queued with ID 0x9d2e13e8a"
           },
           "taskID": "0x9d2e13e8a"
        }
       }
    }
    
  6. Make a note of the <EXPORT_ID> and the <TASK_ID>.

  7. To get the status of export and the signed URLs to download the exported files, use this mutation:

    query {
      exportStatus (
        exportId:"<EXPORT_ID>"
        taskId: "<TASK_ID>"
      ){
        kind
        lastUpdated
        signedUrls
        status
      }
    }
    

    Depending on the format that you chose to create an export, three files are generated.

Note Ensure that you download these files as soon as possible because the signed URLs to download these files expire after 48 hours from the time they were generated. You can use curl -O <SIGNED_URL> to download the files to the current directory.

Exporting data from Dgraph Cloud programmatically

You can also export data from Dgraph Cloud programmatically using the Dgraph Cloud API. For more information, see Cloud API documentation.