此CSV已创建ETL并将其导入OrientDB:
userlist.csv
ID,NAME
1,SATOSHI
2,TONA
3,MIKI
4,YUJI
5,OTA
但是,我不知道如何制作导入此CSV的ETL。
relation.csv
FROM_ID,TO_ID,WEIGHT
1,2,4
1,3,4
1,5,3
2,5,3
2,3,5
...
FROM_ID
和TO_ID
表示ID
的{{1}}。 userlist.csv
是可选的。
请教我如何正确编写ETL。
答案 0 :(得分:0)
试试这个:
{
"source" : {
"file": { "path": "your_path/relation.csv" }
},
"extractor" : {
"csv": {}
},
"transformers": [
{ "command": { "command": "CREATE EDGE E FROM (SELECT FROM userlist-class where id = ${input.FROM_ID}) TO (SELECT FROM userlist-class where id = ${input.TO_ID}) set weight=${input.WEIGHT}"} }
],
"loader" : {
"orientdb": {
"dbURL": "plocal:your-path/databases/db-name",
"dbUser": "your-user",
"dbPassword": "your-pwd",
"serverUser": "your-server-user",
"serverPassword": "your-server-pwd",
"dbType": "graph",
"classes": [{"name": "userlist-class-name", "extends":"V"}]
}
}
}
<强>更新强>
{
"source" : {
"file": { "path": "C:/Users/Sorint.Lab/Desktop/Orient/Community/orientdb-community-2.2.24/config/relation.csv" }
},
"extractor" : {
"csv": {}
},
"transformers": [
{ "command": { "command": "CREATE EDGE USER_RELATION_FRIEND FROM (SELECT FROM userList where id = ${input.FROM_ID}) TO (SELECT FROM userList where id = ${input.TO_ID}) set weight=${input.WEIGHT}"} }
],
"loader" : {
"orientdb": {
"dbURL": "plocal:C:/Users/Sorint.Lab/Desktop/Orient/Community/orientdb-community-2.2.24/databases/stack45504136",
"dbUser": "admin",
"dbPassword": "admin",
"serverUser": "root",
"serverPassword": "root",
"dbType": "graph",
"classes": [
{"name": "userList", "extends":"V"},
{"name": "USER_RELATION_FRIEND", "extends":"E"}
]
}
}
}
希望有所帮助
此致