Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-27-2022 07:22 AM - edited 09-27-2022 07:23 AM
Suppose I have a table with below columns:
emp_id | emp_name | emp_department | date_of_joining
I want to create a composite primary key named "ID" as
ID = emp_id + "_" + date_of_joining
I prepared my data by concatenating two columns and creating ID field. Then using ID field as a primary key in export nodes recipe. Please refer the attachment.
Is there a more straight forward way to define which columns I need to use as a composite key and providing a name for it in recipe, rather than preparing the data manually?
Does neo4j handle this itself and provide an option like it does for defining primary key?
09-27-2022 04:10 PM
Q:Is there a more straight forward way to define which columns I need to use as a composite key and providing a name for it in recipe, rather than preparing the data manually?
A:First import the data without any concatenating. Once the import is done you can write a Cypher query to concatenate ID and date_of_joing properties. Either you can update the existing ID value with the concerted value or add a new property to store the concatenated value. This way you will have the flexibility of selecting properties to concatenate.
Here is an example:
//Created a new employee node...
All the sessions of the conference are now available online