neo4j LOAD CSV returns Couldn't Load external resource - neo4j lost in directory

后端 未结 4 1864
挽巷
挽巷 2020-12-11 06:30

Since I use Neo4j 3.0.1, this cypher query:

USING PERIODIC COMMIT 500  
 LOAD CSV WITH HEADERS  
 FROM >\"file:///home/user/Documents/links.csv\" AS csvLi         


        
相关标签:
4条回答
  • 2020-12-11 07:17

    From the configuration file 'neo4j.conf':

    # This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or uncomment it to
    # allow files to be loaded from anywhere in filesystem; this introduces possible security problems. See the `LOAD CSV`
    # section of the manual for details.
    #dbms.directories.import=import
    
    0 讨论(0)
  • 2020-12-11 07:20

    This is a security that has been integrated in neo4j 3.0 in order to prevent scripts to load sources from an unwanted directory (like /etc/password for example.

    You can add the following setting in conf/neo4j.conf in order to bypass this :

    dbms.security.allow_csv_import_from_file_urls=true
    

    Or just put your csv files in the import directory.

    0 讨论(0)
  • 2020-12-11 07:23

    I was getting a similar error. After reading others' answers, I'm guessing this is indeed a security issue. A quick fix for me was to move my data under the Neo4j/default.graphdb/import directory where Neo4j is trying to redirect anyway. In my case, I had to create the import directory. Now I can load my files using "file:///my_data_dir/test.csv" so long as my_data_dir is nested under Neo4j/default.graphdb/import

    Note: I'm on Mac OS X El Capitan 10.11.6 and running Neo4j Community Edition 3.1.0-BETA1.

    0 讨论(0)
  • 2020-12-11 07:29

    You should comment out this line from the neo4j.conf line:

        dbms.directories.import=import
    

    or set the files at the import

    0 讨论(0)
提交回复
热议问题