I am trying to import the data using bin/neo4j-admin database import full command with 2 node files with header files and 1 relationship with header file.

But facing error that we can't use :ID for more than 1 column. Can't we use more than one columns as primary key while importing using bulk load?

Tried:
CSV files I have used in command.

    node1.csv
    node1_header.csv
    node2.csv
    node2_header.csv
    relation.csv
    relation_header.csv

node1.csv data having a primary key with more than one propery(columns). 
So I added :ID for those columns in node1_header.csv file. 

Issue faced:
    `java.lang.IllegalStateException: There are multiple :ID columns, but they are referring different groups`

Expectating the following:
My data having 6 columns as Unique key. I have to specify those columns as Unique key in node1_header file.

Note: I can create `UNIQUE` constarint from the UI using Cypher query. Problem while using only `neo4j-admin database import full` from command line.
1

There are 1 best solutions below

0
William Lyon On

Per the Neo4j Operations Manual here:

From Neo4j v5.3, a node header can also contain multiple ID columns, where the relationship data references the composite value of all those columns. This also implies using string as id-type. For each ID column, you can specify to store its values as different node properties. However, the composite value cannot be stored as a node property.

So if you are using a version of Neo4j 5.3+ then you should be able to declare "composite" node ids for the bulk import tool in your node header CSV files like this:

people.csv

:ID,:ID,name
1,a,Bob
2,b,Jenny

relationships.csv

:START_ID,:TYPE,:END_ID
1a,KNOWS,2b

You could also create a named "ID Space" using multiple properties, see the documentation for more examples: https://neo4j.com/docs/operations-manual/current/tools/neo4j-admin/neo4j-admin-import/#import-tool-multiple-ids