从neo4j中的大型csv文件仅加载少量样本 [英] Load only few samples from large csv file in neo4j

查看:58
本文介绍了从neo4j中的大型csv文件仅加载少量样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是neo4j db的新手.我的csv文件很大,无法放入机器的ram中.在使用USING PERIODIC COMMIT将所有记录加载到db中之前,我想在少量数据样本上测试cypher查询.如何加载仅加载1000行数据并测试我的查询.

I am new for neo4j db. I've a large csv file which cannot fit in my machine's ram. Before I load all the records in db using USING PERIODIC COMMIT, I want to test my cypher query on the small sample of data. How can I load load just 1000 rows of data and test out my query.

数据的简化列为[Employee, CompanyName].我想将关系创建为(:Employee)-[:Employed]->(:Company). Employee和CompanyName节点已被加载到数据库中.

The data has columns in simplified form as [Employee, CompanyName]. I want to create relationship as (:Employee)-[:Employed]->(:Company). The Employee and the CompanyName nodes are already loaded into the database.

推荐答案

您可以限制要导入的行:

You can limit the rows you want to import with:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS 'file:///yourcsvfile.csv' AS row
WITH row LIMIT 1000
...

,然后继续执行通常的导入Cypher语句.这只会读取文件的前1000行.

and then continue with your usual import Cypher statements. This will read only the first 1000 lines of your file.

这篇关于从neo4j中的大型csv文件仅加载少量样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆