We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
There are many tools available to convert CSV to JSON. You can import large data
sets to Dgraph using Dgraph Live Loader or
Dgraph Bulk Loader. In these examples, the
csv2json
tool is used, and the data is imported using the Mutate tab in
Ratel.
csv2json
conversion tool.jq
a lightweight and flexible command-line JSON processor.Create a names.csv
file with these details:
Change to the directory that contains the names.csv
file and convert it to
names.json
:
To prettify a JSON file, use the jq '.'
command:
The output is similar to:
This JSON file follows the JSON Mutation Format, it can be loaded into Dgraph using Dgraph Live Loader , Dgraph Bulk Loader or the programmatic clients.
To load the data to Ratel and HTTP clients. The JSON data has to be stored
within the "set"
key. You can use
jq
to transform the JSON into the correct format:
An output similar to this appears:
Paste the output in the Mutate tab of Console in Ratel.
Click Run to import data.
To view the imported data paste the following in the Query tab and click Run:
Create a connects.csv
file that’s connecting nodes together. The connects
field should be of the uid
type.
To get the correct JSON format, you can convert the CSV into JSON and use
jq
to transform it in the correct format where the connects
edge is a
node uid
. This JSON file can be loaded into Dgraph using the programmatic
clients.
The output is similar to:
To get an output of the mutation format accepted in Ratel UI and HTTP clients:
The output is similar to:
To reuse existing integer IDs from a CSV file as UIDs in Dgraph, use Dgraph Zero’s assign endpoint before loading data to allocate a range of UIDs that can be safely assigned.
Paste the output in the Mutate tab of Console in Ratel, and click Run to import data.
We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
There are many tools available to convert CSV to JSON. You can import large data
sets to Dgraph using Dgraph Live Loader or
Dgraph Bulk Loader. In these examples, the
csv2json
tool is used, and the data is imported using the Mutate tab in
Ratel.
csv2json
conversion tool.jq
a lightweight and flexible command-line JSON processor.Create a names.csv
file with these details:
Change to the directory that contains the names.csv
file and convert it to
names.json
:
To prettify a JSON file, use the jq '.'
command:
The output is similar to:
This JSON file follows the JSON Mutation Format, it can be loaded into Dgraph using Dgraph Live Loader , Dgraph Bulk Loader or the programmatic clients.
To load the data to Ratel and HTTP clients. The JSON data has to be stored
within the "set"
key. You can use
jq
to transform the JSON into the correct format:
An output similar to this appears:
Paste the output in the Mutate tab of Console in Ratel.
Click Run to import data.
To view the imported data paste the following in the Query tab and click Run:
Create a connects.csv
file that’s connecting nodes together. The connects
field should be of the uid
type.
To get the correct JSON format, you can convert the CSV into JSON and use
jq
to transform it in the correct format where the connects
edge is a
node uid
. This JSON file can be loaded into Dgraph using the programmatic
clients.
The output is similar to:
To get an output of the mutation format accepted in Ratel UI and HTTP clients:
The output is similar to:
To reuse existing integer IDs from a CSV file as UIDs in Dgraph, use Dgraph Zero’s assign endpoint before loading data to allocate a range of UIDs that can be safely assigned.
Paste the output in the Mutate tab of Console in Ratel, and click Run to import data.