【问题标题】:NEO4J Load csv not workingNEO4J 加载 csv 不起作用
【发布时间】:2018-08-07 16:27:15
【问题描述】:

我使用以下 Neo4J 查询尝试从放置在相关数据库的“导入”目录中的 .csv 加载

load csv with headers from "file:///fb4.csv" as line with line
create (:Entry {name:"Co-ordinates", X:toInteger(line.`X`), Y:toInteger(`Y`), Z:toInteger(`Z`), rock_type:line.`GM fault block 4`})

我从中加载它的文件“fb4.csv”具有以下前几行:

# Exported from Leapfrog Geo - UTF-8 encoding
X,Y,Z,GM fault block 4
1492275,5215985,165,Enys Formation
1492285,5215985,165,Enys Formation

在等待完全运行查询所需的 40 秒后,通常我有 460 万个坐标,仅设置了“名称”属性 - 没有设置其他坐标。即,根本没有设置从 fb4.csv 导入的字段。

如何正确解决这个问题?

【问题讨论】:

    标签: csv neo4j cypher


    【解决方案1】:

    load csv 语句不会将第一行作为注释处理,而是将其解释为标题:

    load csv with headers from "file:///fb4.csv" as line with line
    return line
    

    ==>

    {
      "# Exported from Leapfrog Geo - UTF-8 encoding": "X"
    }
    {
      "# Exported from Leapfrog Geo - UTF-8 encoding": "1492275"
    }
    {
      "# Exported from Leapfrog Geo - UTF-8 encoding": "1492285"
    }
    

    从 csv 文件中删除注释行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-07
      • 1970-01-01
      • 2020-02-23
      • 2019-07-16
      相关资源
      最近更新 更多