key

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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com