key

How to designate the incoming a simple unique key to use when loading data from a data file.

Synopsis

key "fieldName"

Description

Each record read from an input data file must be unique to avoid duplication. key defines a simple unique key for this element comprised of a single field and associated property key name.

Examples

Set the key in a mapping script to name:
key "name"
If the data file includes unique ids, such as a GraphSON or Gryo file written from DataStax Enterprise, the key can be set to identify the id:
key "~id" "id"
where ~id defines that the id is found in the data file, and id renames the field to id in the loaded file.
Set a key in a mapping script to a composite custom id:
 key city_id: "city_id", sensor_id: "sensor_id"
This definition uses the following pattern:
 key <csv_column_name1>: "vertex_property_key1", <csv_column_name2>: "vertex_property_key2"
where <csv_column_name> is the column in the input file that specifies the value to be assigned to the vertex_property_key in the graph.