[英]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" } }
],
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.