简体   繁体   English

仅从CSV文件填充顶点

[英]Populating only vertex from CSV file

Need help to know how should I populate my vertex class in orientdb with the csv file. 需要帮助以了解如何使用csv文件填充orientdb中的顶点类。 The format in csv file is CSV文件中的格式为

name,type,status
xxxxx,ABC,3
yyyyy,ABC,1
zzzzz,123,5
--

I have a vertex and edges extended in OrientDB, where the vertex have 3 property name,type and status. 我有一个顶点和在OrientDB中扩展的边,该顶点具有3个属性名称,类型和状态。 I only want the vertex to get populated from csv, the edges will be created dynamically via API 我只希望从csv填充顶点,将通过API动态创建边缘

I tried to create ETL file as below : 我试图创建ETL文件,如下所示:

{
    "source":{"file": { "path": "/tmp/ientdb-community-2.2.18/config/data.csv" } },
        "extractor": { "csv": {} },
        "transformers": [
        { "vertex": { "class": "MyObject" } } 
    ],  
        "loader": {
            "orientdb": {
                "dbURL": "remote:localhost/mydb",
                "dbUser": "root",
                "dbPassword": "root",
                "dbType": "graph",
                "classes": [
                {"name": "MyObject", "extends": "V"},
                ], "indexes": [
                {"class":"MyObject", "fields":["name:string"], "type":"UNIQUE" }
                ]   
            }   
        }   
}

I find that, if I use plocal the root/root credential is not working. 我发现,如果我使用plocal,则root / root凭据不起作用。 And the classes are not as same as when logged in with remote (after starting server) 并且这些类与通过远程登录(启动服务器后)时的类不同

I tried your code and it works for me, this is what I get: 我尝试了您的代码,它对我有用,这就是我得到的: 在此处输入图片说明

the only changes that I made to your code are: credential, and dbUrl plocal instead of remote: 我对您的代码所做的唯一更改是:凭证和dbUrl plocal而不是remote:

{
    "source":{"file": { "path": "mypath/config/data.csv" } },
        "extractor": { "csv": {} },
        "transformers": [
        { "vertex": { "class": "MyObject" } } 
    ],  
        "loader": {
            "orientdb": {
                "dbURL": "plocal:mypath/databases/mydb",
                "dbType": "graph",
                "dbUser": "<user name>",
                "dbPassword": "<user password>",
                **BEGIN UPDATE**
                "serverUser": "<server administrator user name, usually root>",
                "serverPassword": "<server administrator user password that is provided at server startup>",
                **END UPDATE**
                "classes": [
                {"name": "MyObject", "extends": "V"},
                ], "indexes": [
                {"class":"MyObject", "fields":["name:string"], "type":"UNIQUE" }
                ]   
            }   
        }   
}

By the way I noticed that your path is called: ientdb-community-2.2.18 is that correct? 顺便说一句,我注意到您的路径被称为: ientdb-community-2.2.18正确吗?

Hope it helps. 希望能帮助到你。

Regards. 问候。

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

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