2017-06-13 82 views
0

需要幫助以瞭解如何使用csv文件在orientdb中填充我的頂點類。在CSV文件的格式是僅填充CSV文件中的頂點

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

我有一個頂點和邊緣OrientDB,其中頂點有3個屬性的名稱,類型和狀態延長。我只希望頂點擺脫CSV填充,邊將通過動態API來創建

我試圖創建如下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" } 
       ] 
      } 
     } 
} 

我發現,如果我用plocal根/根憑證不起作用。而類是不具有遠程登錄時一樣同

回答

0

我想你的代碼和它的作品對我來說(啓動服務器後),這是我得到: enter image description here

,我做出的唯一改變你的代碼是:證書,並dbUrl plocal代替遙控:

{ 
    "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" } 
       ] 
      } 
     } 
} 

通過我注意到,你的路徑稱爲方式:ientdb-community-2.2.18是正確的?

希望它有幫助。

問候。

+0

感謝您的回覆,您能否告訴我如何使用remote:mypath/database/mydb,因爲頂點類可用於遠程,而不是本地。路徑是正確的,而複製/粘貼它被更改。 – Ayush

+0

嗨,我已經更新了我的答案。希望能幫助到你。 Regards –

+0

感謝Michela的幫助 – Ayush