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
- In the
Admin
section of the Dgraph Cloud console, go toSettings
. - In the
Exports
tab, clickCreate Export
. - In the
New export
dialog, select the format you want to export. - Click
Create
.
Depending on the format that you chose to create an export, three files are generated.
Exporting data from Dgraph Cloud using a GraphQL client
-
Generate API Key for authentication.
-
Make a note of the GraphQL endpoint for the instance from
Overview
in the Dgraph Cloud console. Replace/graphql
with/admin/slash
in the GraphQL endpoint to get the<ADMIN_ENDPOINT>
. -
Authenticate the
admin
API requests by adding the<APIKEY>
as theDg-Auth
header to every HTTP request. -
To export data you need to send authenticated request to
<ADMIN_ENDPOINT>
. -
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" } } }
-
Make a note of the
<EXPORT_ID>
and the<TASK_ID>
. -
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.
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.