一、導(dǎo)入csv數(shù)據(jù)
1、導(dǎo)入但不存庫(kù)
導(dǎo)入本地
load csv from 'file:///E:movies.csv' as line return line
導(dǎo)入網(wǎng)站連接
load csv from 'http://*' as line return line
如果把csv文件放入Neo4j系統(tǒng)路徑的import文件夾內(nèi),則無(wú)需指定csv文件路徑,如下:
load csv form 'file:///moves.csv' as line return line
2、導(dǎo)入并存庫(kù)
1、普通導(dǎo)入
load csv from 'file:///moveis.csv' as line create (:Movie {title:line[0], released:line[1], tagline:line[2]})
2、導(dǎo)入附帶表頭:
load csv from 'file:///moveis.csv' as line create (:Track {TrackId:line.id, Name:line.Track, Length:line.Length})
3、導(dǎo)入csv大文件:
using periodic commit load csv with headers from 'file:///moveis.csv' as line create (:Track {TrackId:line.id, Name:line.Track, length:line.Length})
3.1、可以每800行提交一次
using periodic commit 800 load csv with headers from 'file:///moveis.csv' as line create (:Track {TrackId:line.id, Name:line.Track, length:line.Length})
4、使用neo4j-import工具導(dǎo)入Neo4j
在Neo4j系統(tǒng)下目錄path/to/neo4j/bin/neo4j-import 下的可執(zhí)行文件
bin/neo4j-import --into 數(shù)據(jù)庫(kù)名 --id-type string\
--nodes: Customer customer.csv --nodes product.csv\
--nodes:order_header.csv, orders1.csv, orders2.csv\
--relationships:contains order_details.csv\
--relationships:ordered
customer_order_header.csv, orders1, orders2.csv