[Neo4j - Load CSV ] create not enough nodes in csv file.

51 views
Skip to first unread message

Nguyen Minh Nhut

unread,
Jul 3, 2014, 10:57:19 PM7/3/14
to ne...@googlegroups.com
Hi good guys!
My .csv file have 41879 nodes. When i run the load csv file it just create 13415 nodes.

This is my cypher command:

USING PERIODIC COMMIT 1000 LOAD CSV FROM "file:E:/thanhvien.csv" AS line create (u:ThanhVien { id: line[0], HoTen : line[1] , GioiTinh: line[2], NgaySinh: line[3] , GioiThieuBanThan: line[4], DienThoai: line[5] , DiaChi: line[6] , Email: [7] , NgheNghiep: line[7] , CoQuan: line[8] , SoThichKhac: line[9] , Quan: line[10] , TinhTrangHonNhan: line[11] , HinhDaiDien: line[12] } );

Don't know why!
thanhvien.csv

Michael Hunger

unread,
Jul 4, 2014, 6:29:04 AM7/4/14
to ne...@googlegroups.com
You have several single quotes in your file, which cause our csv reader to continue to read until it finds the next quote.

You have to escape those by doubling them.

Many of them are smileys like this ":)

LOAD CSV FROM "file:///Users/mh/Downloads/thanhvien.csv" AS line return count(*);                

+----------+

| count(*) |

+----------+

| 41881    |

+----------+

1 row



--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nguyen Minh Nhut

unread,
Jul 4, 2014, 11:10:20 AM7/4/14
to ne...@googlegroups.com
I have escaped all the single quotes  by double them and delete all the smileys like you said. Now when i count(*), it reuturns 30375 but not 41879 nodes.
Could you tell me, what characters I should check that affect my results.
Sorry about my bad English.
  


--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/-S1Xdh4ZkrE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.

Michael Hunger

unread,
Jul 4, 2014, 4:25:26 PM7/4/14
to ne...@googlegroups.com
I just deleted all quotes and the emojii smileys ;)

Sent from mobile device

Nguyen Minh Nhut

unread,
Jul 4, 2014, 8:45:23 PM7/4/14
to ne...@googlegroups.com
OK Thks!

Nguyen Minh Nhut

unread,
Jul 9, 2014, 12:40:09 AM7/9/14
to ne...@googlegroups.com
Hi Micheal!
I have a .tsv file. I clean all the characters ' and " in that file.
When i run the load csv command then the console load it, and then do not thing :

USING PERIODIC COMMIT 100
LOAD CSV FROM "file:E:/binhluan.tsv" AS line FIELDTERMINATOR '\t'
MATCH ( a:`ThanhVien`{ id:line[4] } ), ( b:`DiaDiem`{ id:line[2] } )
CREATE (a)-[:BinhLuan{ NoiDung:line[1]}]->(b);

I don't know why, is this b/c content of line[1] is too big.

Michael Hunger

unread,
Jul 14, 2014, 7:33:23 PM7/14/14
to ne...@googlegroups.com
No that should have no influence.
Do you have the users already in your db?

Do you have  and index on :ThanhVien(id) and :DiaDiem(id) ?

try

LOAD CSV FROM "file:E:/binhluan.tsv" AS line FIELDTERMINATOR '\t'
with line limit 100
return line;

and
LOAD CSV FROM "file:E:/binhluan.tsv" AS line FIELDTERMINATOR '\t'
return count(*);

LOAD CSV FROM "file:E:/binhluan.tsv" AS line FIELDTERMINATOR '\t'
with line limit 100

MATCH ( a:`ThanhVien`{ id:line[4] } ), ( b:`DiaDiem`{ id:line[2] } )
return a,b
Reply all
Reply to author
Forward
0 new messages