繁体   English   中英

带有JSON数据文件的OrientDB ETL

[英]OrientDB ETL with JSON data file

我没有看到有关如何使用OrientDB ETL函数加载JSON 数据文件的好的文档。

我正在运行以下命令:./oetl.sh ../template_etl.json
template_etl.json的内容如下所示:

{
    "config": {
        "log": "debug"
    },
    "begin": [
    ],
    "source" : {
        "file": {"path": "../repos.json", "lock" : true }
    },
    "extractor" : {
        "row": {}
    },
    "transformers" : [
        {"json"},
        { "vertex": { "class": "V" } }
    ],
    "loader" : {
        "orientdb": {
            "dbURL": "plocal../databases/template",
            "dbUser": "admin",
            "dbPassword": "admin",
            "dbAutoCreate": true,
            "tx": false,
            "batchCommit": 1000,
            "dbType": "graph"
        }
    }
}

我从https://www.udemy.com/orientdb-getting-started/#/lecture/1998370的csv示例中获取了此示例,其中此行:{“ json”},最初是:{“ csv”:{“分隔符“:”,“,” multiValue“:” NULL“,” skipFrom“:1,” skipTo“:1}},

我收到的错误是: orientdb-community-2.0 / bin $ ./oetl.sh ../template_etl.json

OrientDB etl v.2.0 (build @BUILD@) www.orientechnologies.com
Exception in thread "main" com.orientechnologies.orient.core.exception.OSerializationException: Error on unmarshalling JSON content for record: "config": {
        "log": "debug"
    },
    "begin": [
    ],
    "source" : {
        "file": {"path": "../repos.json", "lock" : true }
    },
    "extractor" : {
        "row": {}
    },
    "transformers" : [
        {"json"},
        { "vertex": { "class": "V" } }
    ],
    "loader" : {
        "orientdb": {
            "dbURL": "plocal../databases/template",
            "dbUser": "admin",
            "dbPassword": "admin",
            "dbAutoCreate": true,
            "tx": false,
            "batchCommit": 1000,
            "dbType": "graph"
        }
    }

    at   com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromString(ORecordSerializerJSON.java:304)
        at com.orientechnologies.orient.core.record.ORecordAbstract.fromJSON(ORecordAbstract.java:165)
        at com.orientechnologies.orient.core.record.impl.ODocument.fromJSON(ODocument.java:1712)
        at com.orientechnologies.orient.etl.OETLProcessor.main(OETLProcessor.java:147)
    Caused by: com.orientechnologies.orient.core.exception.OSerializationException: Error on unmarshalling JSON content: wrong format ""json"". Use <field> : <value>
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromString(ORecordSerializerJSON.java:181)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValueAsRecord(ORecordSerializerJSON.java:595)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValueAsObjectOrMap(ORecordSerializerJSON.java:565)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValue(ORecordSerializerJSON.java:413)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.parseCollection(ORecordSerializerJSON.java:677)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValueAsEmbeddedCollection(ORecordSerializerJSON.java:659)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValueAsCollection(ORecordSerializerJSON.java:638)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.getValue(ORecordSerializerJSON.java:415)
        at com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerJSON.fromString(ORecordSerializerJSON.java:249)
        ... 3 more

我希望有一种方法可以将JSON 数据文件直接加载到OreintDB中。

谢谢

json无效。 尝试通过www.jsonlint.com进行验证。 尝试更换:

{"json"},

带有:

{"json": {} },

我不是Lvca的专家,但是您的源文件具有json扩展名。 这意味着您的提取器必须替换为(“ json”:{}),并且没有“ json”转换器。

"extractor" : {
    "json": {}
},
"transformers" : [
    { "vertex": { "class": "V" } }
],

http://orientdb.com/docs/last/Transformer.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM