简体   繁体   中英

How To Load CSV file in Neo4j in linux Machine

I'm trying to load the CSV file in to Neo4j. But it was throwing error like this

Couldn't load the external resource at: file:/home/trainings/Desktop/neo4j-community-3.0.6/import/home/trainings/Desktop/neo4j_module_datasets/terrorist_data_subset.csv

I tried changing the neo4j.conf file. I have changed

dbms.directories.import=import
dbms.security.allow_csv_import_from_file_urls=true

even though im facing the error. 在此处输入图片说明

It's a little bit old post but I would like to share answer.

On Ubuntu linux neo4j version 3.2.2 open the conf from /etc/neo4j/neo4j.conf .

Find the line dbms.directories.import . Modify this path to change the default import location or comment out to load using the absolute path from '/ '.

Then add the file path in query as below.

LOAD CSV FROM 'file:///artists.csv' AS line CREATE (:Artist { name: line[1], year: toInt(line[2])})

注释掉这个配置行: dbms.directories.import=import

只需将 .CSV 放入 Import 文件夹,我们就可以将数据加载到 Neo4j 中

If you comment out the dbms.directories.import=import (located within /etc/neo4j/neo4j.conf ), this allows system-wide access from neo4j dangerous , but maybe fine if it is only run on a personal machine.

To enable changes you must then kill all neo4j processes and restart the server pkill -u neo4j ; sudo neo4j start pkill -u neo4j ; sudo neo4j start . When loading you should get something similar to:

Active database: graph.db
Directories in use:
  home:         /var/lib/neo4j
  config:       /etc/neo4j
  logs:         /var/log/neo4j
  plugins:      /var/lib/neo4j/plugins
  import:       NOT SET
  data:         /var/lib/neo4j/data
  certificates: /var/lib/neo4j/certificates
  run:          /var/run/neo4j

Note the NOT SET in the import row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM