Nebula Importer - Can't import INT vertex ids

I’m using Nebula Importer from the Docker image and I’m trying to import graph data from CSV files. I’m getting the following error:

[ERROR] handler.go:63: Client 25 fail to execute: INSERT VERTEX `group`(`name`,`subtype`) VALUES  "212674054": ("Some test name","SomeSubtypeValue");, ErrMsg: Wrong vertex id type: "212674054", ErrCode: -1005

I suppose this is because my graph space has VID type: INT64. Indeed, when I remove the double qoutes from around the VID in the query, and run the query through console, it works:

INSERT VERTEX `group`(`name`,`subtype`) VALUES  212674054: ("Some test name","SomeSubtypeValue");

My question is if there is any way to tell the Nebula Importer to handle VID as integer, as opposed to string.

Sorry @miso , for now, the importer will reasoning vid type during the parsing, that is, if it’s quoted, then it’s typed in string, could you please remove quotes in the CSV file itself?

Thank you for your answer. Unfortunatelly, there are no quotes in the CVS file. The file looks like this:

621812,#sometag,classA
621830,sometext,classB
82357,anotherText,classB
...
1 Like

Sorry, by default, the schema vid type will be string if the type field is omitted.

w/o schema.vertex.vid.type being specified:

  - path: ./person.csv
    failDataPath: ./err/person.csv
    batchSize: 32
    inOrder: true
    type: csv
    csv:
      withHeader: false
      withLabel: false
    schema:
      type: vertex
      vertex:
        vid:
          index: 0
        tags:
          - name: person
            props:
              - name: name
                type: string
                index: 1

string was set

2021/12/20 09:04:45 --- START OF NEBULA IMPORTER ---
2021/12/20 09:04:45 [WARN] config.go:554: Not set files[0].schema.vertex.vid.Type, reset to default value `string'
2021/12/20 09:04:45 [WARN] config.go:554: Not set files[1].schema.vertex.vid.Type, reset to default value `string'
2021/12/20 09:04:53 [INFO] clientmgr.go:28: Create 4 Nebula Graph clients
2021/12/20 09:04:53 [INFO] reader.go:64: Start to read file(0): /root/person.csv, schema: < :VID(string),person.name:string >
2021/12/20 09:04:53 [INFO] reader.go:64: Start to read file(1): /root/corp.csv, schema: < :VID(string),corp.name:string >

...

After specifying type:

@@ -30,6 +30,7 @@
       vertex:
         vid:
           index: 0
+          type: int
         tags:
           - name: person
             props:
@@ -50,6 +51,7 @@
       vertex:
         vid:
           index: 0
+          type: int
         tags:
           - name: corp
             props:

Now, int was used.

2021/12/20 09:05:53 --- START OF NEBULA IMPORTER ---
2021/12/20 09:06:01 [INFO] clientmgr.go:28: Create 4 Nebula Graph clients
2021/12/20 09:06:01 [INFO] reader.go:64: Start to read file(1): /root/corp.csv, schema: < :VID(int),corp.name:string >
2021/12/20 09:06:01 [INFO] reader.go:64: Start to read file(0): /root/person.csv, schema: < :VID(int),person.name:string >
...
2021/12/20 09:06:02 Finish import data, consume time: 8.65s
2021/12/20 09:06:03 --- END OF NEBULA IMPORTER ---

I think this should be highlighted somewhere in the readme. Sorry for confusing you!

1 Like

PR on readme of nebula-importer: Update README.md by wey-gu · Pull Request #183 · vesoft-inc/nebula-importer · GitHub

It turned out it’s already in documentation of nebula-importer:

https://docs.nebula-graph.io/2.6.1/nebula-importer/use-importer/#schema_configuration

files.schema.vertex.vid.type - No The data type of the vertex ID. Possible values are int and string.

Thank you very much for your help. This indeed works. I was unfortunatelly looking at the docs on Github (not only the README, but also here).

For any other people struggling with this I only would like to add, that the srcVID.type and dstVID.type should also be specified in the files.schema.edge part of the config.

1 Like

Thanks for pointing out that, too, addressed in the PR now.

Sorry for confusing you with the outdated docs in GitHub. :stuck_out_tongue:

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.