Neo4j-csv文件导入

一、导入csv数据

1、导入但不存库

导入本地

load csv from 'file:///E:movies.csv' as line return line

导入网站连接

load csv from 'http://*' as line return line

如果把csv文件放入Neo4j系统路径的import文件夹内,则无需指定csv文件路径,如下:

load csv form 'file:///moves.csv' as line return line

2、导入并存库

1、普通导入

load csv from 'file:///moveis.csv' as line create (:Movie {title:line[0], released:line[1], tagline:line[2]})

2、导入附带表头:

load csv from 'file:///moveis.csv' as line create (:Track {TrackId:line.id, Name:line.Track, Length:line.Length})

3、导入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工具导入Neo4j

在Neo4j系统下目录path/to/neo4j/bin/neo4j-import 下的可执行文件

    bin/neo4j-import --into 数据库名 --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

你可能感兴趣的:(Neo4j-csv文件导入)