Nikhil Jain
Nikhil Jain

Reputation: 619

Neo4j duplicate input id exception

I am new to neo4j and I am trying to construct bitcoin transaction graph using it. I am following this link behas/bitcoingraph to do so, I came across the neo4j import command to create a database

$NEO4J_HOME/bin/neo4j-import --into $NEO4J_HOME/data/graph.db \ 
  --nodes:Block blocks_header.csv,blocks.csv \ 
  --nodes:Transaction transactions_header.csv,transactions.csv \
  --nodes:Output outputs_header.csv,outputs.csv \  .......

After executing the above command I encountered an error

Exception in thread "Thread-1" org.neo4j.unsafe.impl.batchimport.cache.idmapping.string.DuplicateInputIdException: Id '00000000f079868ed92cd4e7b7f50a5f8a2bb459ab957dd5402af7be7bd8ea6b' is defined more than once in Block, at least at /home/nikhil/Desktop/Thesis/bitcoingraph/blocks_0_1000/blocks.csv:409 and /home/nikhil/Desktop/Thesis/bitcoingraph/blocks_0_1000/blocks.csv:1410

Here is the block_header. csv

hash:ID(Block),height:int,timestamp:int

Does anyone know how to fix it? I read there is a solution available in id-spaces but I am not quiet sure how to use it. Thanks in advance for any help

Upvotes: 5

Views: 1342

Answers (1)

cybersam
cybersam

Reputation: 66975

The --skip-duplicate-nodes flag will skip import of nodes with the same ID instead of aborting the import.

For example:

$NEO4J_HOME/bin/neo4j-import --into $NEO4J_HOME/data/graph.db \ 
  --nodes:Block blocks_header.csv,blocks.csv --skip-duplicate-nodes \ 
  --nodes:Transaction transactions_header.csv,transactions.csv \
  --nodes:Output outputs_header.csv,outputs.csv \  .......

Upvotes: 5

Related Questions