简体   繁体   English

使用CSV导入啤酒数据库时出错

[英]Error while importing beers database using CSV

I have the latest community edition 2.2.17. 我有最新的社区版2.2.17。 While importing the beers database using csv I am getting error while importing the beers. 使用csv导入啤酒数据库时导入啤酒时出错。 (categories, styles etc. all got imported fine). (类别,款式等都进口良好)。 The errors are like: 错误如下:

    OrientDB etl v.2.2.17 (build 2.2.x@rd9bace82ea8437117fd48114fc255e791056014b; 2017-02-16 17:20:27+0000) www.orientdb.com
[csv] INFO column types: {last_mod=ANY, abv=ANY, filepath=ANY, name=ANY, cat_id=ANY, upc=ANY, id=ANY, brewery_id=ANY, style_id=ANY, descript=ANY, ibu=ANY, srm=ANY}
BEGIN ETL PROCESSOR
[file] INFO Reading from file C:/Database_studies/nosql/orientdb/Import/OrientDB_self_study_files/beerdb/openbeerdb_csv/beers.csv with encoding UTF-8
Started execution with 1 worker threads
[csv] ERROR Error on converting row 1 field 'last_mod' , value '2010-07-22 20:00:20' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'abv' , value '4.5' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'filepath' , value '' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'name' , value 'Hocus Pocus' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'cat_id' , value '11' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'upc' , value '0' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'id' , value '1' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'brewery_id' , value '812' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'style_id' , value '116' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'descript' , value 'Our take on a classic summer ale.  A toast to weeds, rays, and summer haze.  A light, crisp ale for mowing lawns, hitting lazy fly balls, and communing with nature, Hocus Pocus is offered up as a summer sacrifice to clodless days.

Its malty sweetness finishes tart and crisp and is best apprediated with a wedge of orange.' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'ibu' , value '0' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 1 field 'srm' , value '0' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'last_mod' , value '2010-07-22 20:00:20' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'abv' , value '6.7' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'filepath' , value '' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'name' , value 'Grimbergen Blonde' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'cat_id' , value '-1' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'upc' , value '0' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'id' , value '2' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'brewery_id' , value '264' (class:java.lang.String) to type: ANY
[csv] ERROR Error on converting row 2 field 'style_id' , value '-1' (class:java.lang.String) to type: ANY

The command I used to import is same as given in the documentation: ./oetl.sh /temp/openbeer/beers.json 我用来导入的命令与文档中给出的命令相同:./ etc.sh /temp/openbeer/beers.json

(with the directory name changed to the actual one in my system). (目录名称已更改为我系统中的实际名称)。

Can someone please suggest. 有人可以建议。

Here is my beers.json file: 这是我的beers.json文件:

    {
"config" : { "haltOnError": false },
"source": { "file": { "path": "C:/Database_studies/nosql/orientdb/Import/OrientDB_self_study_files/beerdb/openbeerdb_csv/beers.csv" } },
"extractor": { "csv": { "columns": ["id","brewery_id","name","cat_id","style_id","abv","ibu","srm","upc","filepath","descript","last_mod"],
"columnsOnFirstLine": true } },
"transformers": [
{ "vertex": { "class": "Beer" } },
{ "edge": { "class": "HasCategory", "joinFieldName": "cat_id", "lookup": "Category.id" } },
{ "edge": { "class": "HasBrewery", "joinFieldName": "brewery_id", "lookup": "Brewery.id" } },
{ "edge": { "class": "HasStyle", "joinFieldName": "style_id", "lookup": "Style.id" } }
],
"loader": {
"orientdb": {
"dbURL": "plocal:C:/orientdb_install_031217/orientdb-community-2.2.17/databases/openbeerdb",
"dbType": "graph",
"classes": [
{"name": "Beer", "extends": "V"},
{"name": "HasCategory", "extends": "E"},
{"name": "HasStyle", "extends": "E"},
{"name": "HasBrewery", "extends": "E"}
], "indexes": [
{"class":"Beer", "fields":["id:integer"], "type":"UNIQUE" }
]
}
}
}

Thanks, DBuserN 谢谢,DBuserN

My suggestion is to explicate the types for each column 我的建议是解释每列的类型

"extractor": { "csv": { "columns": ["id:integer","brewery_id:integer","name:string","cat_id:integer","style_id:integer","abv:integer","ibu:integer","srm:integer","upc:integer","filepath:string","descript:string","last_mod:dateTime"]

Check the CSV extractor documentation: 检查CSV提取器文档:

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

And be sure the default dateTimeFormat is right for your input file. 并确保默认的dateTimeFormat适合您的输入文件。


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

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