我有三个关于导入csv的问题:
答案 0 :(得分:2)
1)是的,您也可以在LOAD CSV中使用SKIP:
LOAD CSV WITH HEADERS FROM "file:///dummyfile.csv" AS row
WITH row
SKIP 1
MERGE (n:Node {id: row[0]})
2)如果csv列值为NULL,则相应的属性值也将为null。如果为空,则不会创建属性
假设以下CSV:
id,title,desc
1,title 1,desc1
2,,desc 2
以下LOAD CSV:
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/ikwattro/ed85bfc98c9298924c154ecf3e0ab2aa/raw/54a9303c365a7698c87728d458f8de703a9c22e1/load.csv" AS row
CREATE (n:Post {id: row['id'], title: row['title'], description: row['desc']})
这将创建以下内容:
╒══════════════════════════════════════════════════╕
│"n" │
╞══════════════════════════════════════════════════╡
│{"description":"desc1","id":"1","title":"title 1"}│
├──────────────────────────────────────────────────┤
│{"description":"desc 2","id":"2"} │
└──────────────────────────────────────────────────┘
3)是的,Neo4j是无模式的,你不需要在具有相同标签的节点上拥有相同数量的属性