Can't import data in orientdb

251 views
Skip to first unread message

Anthony Wong

unread,
Dec 29, 2016, 5:22:10 AM12/29/16
to OrientDB
I would like to upload the data in OrientDB, but have errors. Here is the json file: Try to upload the data in csv file and make the linkage with server and virtualmachine

{
    "source": {
        "file": {
            "path": "/root/Orientdb/bin/temp/datasets/server.csv"
        }
    },
    "extractor": {
        "row": {}
    },
    "transformers": [{
        "csv": {
            "separator": ",",
            "columnsOnFirstLine": false,
            "columns": ["name", "description", "servercategory", "primarysupport", "secondarysupport", "powersource", "serialnumber", "brand", "model", "serverlocation", "osfamily", "osversion", "cpuspeed", "ram", "numberofprocessor", "cpucorecount", "leftpowersource", "rightpowersource"]
        }
    }, {
        "vertex": {
            "class": "Server"
        }
    }, {
        "merge": {
            "joinFieldName": "virtualhost",
            "lookup": "Server.name"
        }
    }, {
        "edge": {
            "class": "VirtualMachine",
            "joinFieldName": "to",
            "lookup": "Server.name",
            "unresolvedLinkAction": "CREATE"
        }
    }],
    "loader": {
        "orientdb": {
            "dbURL": "plocal:/databases/GratefulDeadConcerts",
            "dbType": "graph",
            "wal": false,
            "batchCommit": 1000,
            "tx": true,
            "txUseLog": false,
            "useLightweightEdges": true,
            "classes": [{
                "name": "Server",
                "extends": "V"
            }, {
                "name": "VirtualMachine",
                "extends": "E"
            }],
            "indexes": [{
                "class": "Server",
                "fields": ["id:name"],
                "type": "UNIQUE"
            }]
        }
    }
}

However, there are errors after run the command (./oetl.sh server.json) . What should I do to fix the issue? Or i should not create the class (Server and VirtualMachine) before run the script? Thanks.

The error message is


BEGIN ETL PROCESSOR
[file] INFO Reading from file /root/Orientdb/bin/temp/datasets/server.csv with encoding UTF-8
Started execution with 1 worker threads
ETL process has problem: java.lang.IllegalArgumentException: No enum constant com.orientechnologies.orient.core.metadata.schema.OType.NAME
END ETL PROCESSOR
+ extracted 0 rows (0 rows/sec) - 0 rows -> loaded 0 vertices (0 vertices/sec) Total time: 5ms [0 warnings, 0 errors]

Ivan Mainetti

unread,
Dec 29, 2016, 6:56:38 AM12/29/16
to OrientDB
how did you defined the index on Server class?

Anthony Wong

unread,
Dec 29, 2016, 8:16:03 PM12/29/16
to OrientDB
Thanks Ivan, I created the index in the class server
CREATE INDEX server_name ON Server (name) NOTUNIQUE METADATA {ignoreNullValues: true}



Ivan Mainetti於 2016年12月29日星期四 UTC+8下午7時56分38秒寫道:

Ivan Mainetti

unread,
Jan 2, 2017, 2:42:15 AM1/2/17
to orient-...@googlegroups.com
this error
ETL process has problem: java.lang.IllegalArgumentException: No enum constant com.orientechnologies.orient.core.metadata.schema.OType.NAME
means that name isn't a valid type. you should use String

"indexes": [{
                "class": "Server",
                "fields": ["id:string"],
                "type": "UNIQUE"
            }]
ref: http://orientdb.com/docs/2.2.x/Loader.html#orientdb


PS
you firstly declared the index as NOTUNIQUE but in etl you declare it as UNIQUE, that doesn't feel very correct..



Il giorno giovedì 29 dicembre 2016 11:22:10 UTC+1, Anthony Wong ha scritto:

Anthony Wong

unread,
Jan 3, 2017, 4:42:05 AM1/3/17
to OrientDB
Thanks Ivan.

I updated the type to String. It prompts that can't create the property 'id' inside a transaction. Here the id means the wrong name in my server class? or I should create the column of my index? 

ETL process has problem: com.orientechnologies.orient.core.exception.OSchemaException: Cannot create property 'id' inside a transaction
        DB name="GratefulDeadConcerts"
END ETL PROCESSOR


Ivan Mainetti於 2017年1月2日星期一 UTC+8下午3時42分15秒寫道:

Ivan Mainetti

unread,
Jan 3, 2017, 4:49:58 AM1/3/17
to OrientDB
does the id property actually exists in Server class?

Anthony Wong

unread,
Jan 3, 2017, 7:54:10 PM1/3/17
to OrientDB
I updated the id to name, which have this attribute in server class

"indexes": [{
                                "class": "Server",
                                "fields": ["name:string"],
                                "type": "NOTUNIQUE"

but have the same error

Started execution with 1 worker threads
ETL process has problem: com.orientechnologies.orient.core.exception.OSchemaException: Cannot create property 'name' inside a transaction

        DB name="GratefulDeadConcerts"
END ETL PROCESSOR


Ivan Mainetti於 2017年1月3日星期二 UTC+8下午5時49分58秒寫道:

Ivan Mainetti

unread,
Jan 4, 2017, 12:35:24 AM1/4/17
to OrientDB
1) can you explain what is your expected final db structure after the import? Does the db schema already exist before the import?

2) in you csv transformer I read "columnsOnFirstLine": false but your csv file (taken from stackoverflow question) does have columns on first line..

Thanks.
Reply all
Reply to author
Forward
0 new messages