Reputation: 21
for initial data import (step 1) into Neo4j database I'm using the neo4j-admin import tool. There you can specify the internal id of a node by :ID in the header.
I would also like to use LOAD CSV
command for creating more nodes (step 2) into an already existing database (with data from previous step). I can't find the answer on how to specify internal id of a node by using this command.
Why it is not possible, while at initial import it is? In second step I'm having a similar csv files as in the first step, which means I have a csv file of nodes with first column being an id of a node AND I have a csv file of relationships between them with columns be like start_id,end_id,relationshipType.
Thanks, Petr M
Upvotes: 0
Views: 110
Reputation: 67019
You have misunderstood how the ID
s contained in the import input files are used. They are not used as native IDs.
The ID
s in the input data files are only used to enable the import
tool to know that node X in file A is supposed to be the same as node Y in file B. After the import is completed, the ID
s from the files are forgotten.
Whenever a node is created, the neo4j server always decides on its own what the actual native ID will be.
Also, it is never recommended to store native IDs in the DB, since it is not a reliable way to identify a specific entity (node or relationship) over time. After an entity is deleted, its native ID can be re-assigned to a new entity.
Upvotes: 1