Populating only vertex from CSV file

67 views Asked by At

Need help to know how should I populate my vertex class in orientdb with the csv file. The format in csv file is

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. I only want the vertex to get populated from csv, the edges will be created dynamically via API

I tried to create ETL file as below :

{
    "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. And the classes are not as same as when logged in with remote (after starting server)

1

There are 1 answers

2
Michela Bonizzi On BEST ANSWER

I tried your code and it works for me, this is what I get: enter image description here

the only changes that I made to your code are: credential, and dbUrl plocal instead of 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?

Hope it helps.

Regards.