在使用nebular importer导入ldbc测试数据的时候,我按照官方示例有头文件的配置文件方式,出现数据插入错误,这里想请教下大家,多多指教


person_0_0.csv (125.9 KB)

config.yml (2.8 KB)

# 导入任务名称
name: myimporter

# 配置文件版本
version: v2

# 数据源配置
source:
  type: csv
  path: /root/ng/ldbc_snb/ldbc_snb_datagen_hadoop/test_data/social_network/dynamic/person_0_0.csv
  csv:
    delimiter: "|"
    header: true
  schema:
    id: string
    firstName: string
    lastName: string
    gender: string
    birthday: string
    creationDate: string
    locationIP: string
    browserUsed: string

# Nebula Graph 目标数据库配置
sink:
  # Nebula Graph 服务器的地址和端口号
  # 如果 Nebula Graph 服务器运行在本地,可以将地址设置为 127.0.0.1
  type: client
  connection:
    user: root
    password: 123
    address: ["127.0.0.1:9669"]
    timeout: 3000
  nebula:
    space: my_space
    errorMax: 0
    concurrency: 10


  # 数据写入模式
  # 如果数据已经存在,是否覆盖
  # 如果覆盖,会删除已有的数据
  # 如果不覆盖,会将新数据追加到已有数据的后面
  #可选值为 "overwrite" 和 "append"
  mode: overwrite
  logPath: /root/ng/ldbc_snb/nebula-importer-3.4.0/file.log
  removeTempFiles: true

  # Nebula Graph 中的标签和属性名称
  # 用于将 CSV 文件中的列映射到 Nebula Graph 中的标签和属性
  # 例如,下面的配置表示将 CSV 文件中的 "id" 列映射到 Nebula Graph 中的 "person" 标签的 "id" 属性
  # 如果需要将多个列映射到多个标签和属性,可以添加多个映射规则
  vertex:
    fields:
      - name: id
        type: string
      - name: firstName
        type: string
      - name: lastName
        type: string
      - name: gender
        type: string
      - name: birthday
        type: string
      - name: creationDate
        type: string
      - name: locationIP
        type: string
      - name: browserUsed
        type: string

  # Nebula Graph 客户端参数配置
  clientSettings:
    concurrency: 10
    channelBufferSize: 128
    connection:
      user: root
      password: 123
      timeout: 3000000000

你用的什么版本的 importer?和我们的配置文件的模版都不一样的…

你好,我使用的是nebula-importer-3.4.0,编译之后产生了nebula-importer。
配置文件的模板找的是官网的:

https://docs.nebula-graph.com.cn/2.0/nebula-importer/config-with-header/

nebula-graph配置文件不一样吗,可以让我参照一下你的吗


版本不匹配,参考对应文档:https://docs.nebula-graph.com.cn/3.4.1/nebula-importer/use-importer/

参照了对应文档,改了这次的配置文件存在其他问题,请教您这个配置文件应该怎样写,我这个只是导入示例的配置文件,感觉配置起来老是不正确,AI也没给出正确修改问题。

version: v2
description: example
removeTempFiles: false
clientSettings:
  retry: 3
  concurrency: 10
  channelBufferSize: 128
  space: my_space
  connection:
    user: root
    password: nebular
    address: 127.0.0.1:9669
workingDir: ./workdata/
logPath: ./err/test.log
files:
  - path: /root/ng/ldbc_snb/ldbc_snb_datagen_hadoop/test_data/social_network/dynamic/person_0_0.csv
    failDataPath: ./err/person/
    batchSize: 128
    limit: 10
    inOrder: false
    type: csv
    csv:
      withHeader: true
      withLabel: false
      delimiter: "|"
      lazyQuotes: false

schema:
  type: vertex
  vertex:
    vid:
      index: 1
      concatItems: # "c1{index0}c2{index1}2"
        - "c1"
        - 0
        - c2
        - 1
        - "2"
      function: hash
      prefix: abc
    tags:
      - name: person
        props:
          - name: id
            type: string
          - name: firstName
            type: string
          - name: lastName
            type: string
          - name: gender
            type: string
          - name: birthday
            type: int
          - name: creationDate
            type: int
          - name: locationIP
            type: string
          - name: browserUsed
            type: string

正如思为在微信群里说的那样

你去 importer 看一下 example 里的 withheader 的例子,header 的情况下 yaml 里无需定义 prop/vid 到 列的对应关系,但是 header 的格式是有要求的

你看文档,对着文档的配置示例来。




我刚才正想去在再问一下带表头的配置呢,我这边看教程您看这样对吗,表头的特殊格式,然后对应的配置文件现在是上面那个,可还是出现了问题。


然后我从importer的github上没有找到有关表头具体格式的使用方式。

最终解决:
github有关CSV有头文件的格式描述更加详细




推荐:
使用nebular importer导入数据时,不知道config.yaml文件格式怎样写,可以下载nebular studio下载模板配置文件修改,官方核心手册与github(更详细些)简介互作参考

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。