# Neo4j admin import relationship

**URL:** <https://community.neo4j.com/t/neo4j-admin-import-relationship/11640>\
**Category:** Import / Export\
**Tags:** import\
**Created:** [November 6, 2019, 4:43am UTC](https://community.neo4j.com/t/neo4j-admin-import-relationship/11640 "2019-11-06T04:43:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khaled](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/khaled/32/4694_2.png) [@Khaled](https://community.neo4j.com/u/Khaled)\
**Post date:** [November 6, 2019, 4:43am UTC](https://community.neo4j.com/t/neo4j-admin-import-relationship/11640/1 "2019-11-06T04:43:34Z")

</div>

Hi there,  
I am trying to import a large dataset consists of 8 CSV files using admin import but I am facing difficulty on how to create relationships among them.

Here is the explanation of the CSV files.

1. Addresses.csv. consists of two columns  
addID, address
2. users.csv addID, userID.
3. Transaction.csv  
txID, blockID,n\_inputs, n\_outputs
4. Incoiming Transaction.csv  
txID, addID, value.
5. Outcoming Transaction.csv  
txId, addID, value.
6. Hash Transaction.csv  
txID, hash
7. Transaction Time.  
txID, unixtim
8. Balances.csv  
addID, balance

I want to create relationships among them based on the addID and txID exist in each file.  
Note that, I create a header of each file in a separate CSV file. I was able to successfully create the addresses and users relationship using:

```auto
neo4j-admin import --id-type=STRING \ 
  --nodes:User="import/users-header.csv,import/users.csv" \ 
  --nodes:Address="import/addresses-header.csv,import/addresses.csv" \ 
  --relationships:PARTOF="import/partof-header.csv,import/users.csv,import/addresses.csv" \ 
  --ignore-missing-nodes=true \ 
  --ignore-duplicate-nodes=true \ 
  --high-io=true 

```

and the partof-header.csv is as following:  
`START_ID(Address),:END_ID(User)` ,

the addresses-header is

`addID:ID(Address),address`

and users-header is

`addID:IGNORE,userID:ID(User)`

but when it comes to other files, I faced difficulty to create the relationship.

Can anyone guide me on how to create relationships based on their IDs.

Does anyone have any suggestions on how I could do this more efficiently?

Many thanks,  
Khaled

---

<div class="post-metadata">

**Author:** ![mark.needham](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/mark.needham/32/104_2.png) [@mark.needham](https://community.neo4j.com/u/mark.needham)\
**Post date:** [November 6, 2019, 3:36pm UTC](https://community.neo4j.com/t/neo4j-admin-import-relationship/11640/2 "2019-11-06T15:36:50Z")

</div>

I think you could do that like this:

```auto
neo4j-admin import --id-type=STRING \ 
  --nodes:User="import/users-header.csv,import/users.csv" \ 
  --nodes:Address="import/addresses-header.csv,import/addresses.csv" \ 
  --relationships:PARTOF="import/partof-header.csv,import/users.csv,import/addresses.csv" \ 
  --relationships:ADDRESS="import/address-header.csv,import/Incoiming Transaction.csv" \ 
  --ignore-missing-nodes=true \ 
  --ignore-duplicate-nodes=true \ 
  --high-io=true 

```

where import/address-header.csv contains the following:

```auto
:START_ID(Transaction),:END_ID(Address),value

```

You can process the CSV multiple times to create different parts of the graph.

Does that make sense/work for you?

---

<div class="post-metadata">

**Author:** ![Khaled](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/khaled/32/4694_2.png) [@Khaled](https://community.neo4j.com/u/Khaled)\
**Post date:** [November 11, 2019, 7:57am UTC](https://community.neo4j.com/t/neo4j-admin-import-relationship/11640/3 "2019-11-11T07:57:08Z")

</div>

Sorry for late reply, Thank you for replying me  
I have already successfully loaded the files into neo4j by assigning the files that contain the primary keys in the node and the files contain foreign keys in the relationship.  
I first match the files that have only addID and txID with the files that have primary keys in the node using Emeditor, then i used the following codes to process the data.

neo4j-admin import --id-type=STRING ---nodes:User="import/users-header.csv,import/user.csv" --nodes:Address="import/addresses-header.csv,import/addresses.csv" --nodes:Txhash="import/txhash-header.csv,import/txht.csv" --relationships:PARTOF="import/partof-header.csv,import/user.csv,import/addresses.csv" --relationships:TO="import/incoming-header.csv,import/txin.csv" --relationships:SENDING="import/outcoming-header.csv,import/txout.csv" --ignore-missing-nodes=true --ignore-duplicate-nodes=true --high-io=true
