无法在orientdb中导入数据

时间:2016-12-22 05:41:47

标签: graph import etl orientdb nosql

我想在OrientDB中上传数据,但有错误。 这是json文件:尝试上传csv文件中的数据并与服务器和虚拟机器建立链接

{
    "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"
            }]
        }
    }
}

但是,运行命令(./oetl.sh server.json)后会出现错误。我该怎么做才能解决这个问题?或者我不应该在运行脚本之前创建类(Server和VirtualMachine)?感谢。

错误消息是

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]

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

请在你的json中使用下面的merge和edge block并检查。

{         "合并":{             " joinFieldName":" to",             "查找":" Server.name"         }     },{         " edge":{             " class":" VirtualMachine",             " joinFieldName":"虚拟主机" ,             "查找":" Server.name" ,             " unresolvedLinkAction":" CREATE"         }

由于