2

I am using orientdb 2.1.13

I can load the csv file >> please see oetl class Names get created, but cannot see the records in the classes Thanks for your support. RayN.

test.json

{

    "config": {"log":"debug"},

    "source": {"file": {"path": "/usr/share/orientdb-community-2.1.13/niloy_data/test.csv"}},

    "extractor":{ "csv": {}},

    "transformer": [
        {"vertex": {"class": "Names"}}
    ],

    "loader": {
        "orientdb": {
            "dbURL": "plocal:/usr/share/orientdb-community-2.1.13/databases/test",
            "dbType": "graph",
            "dbUser": "admin",
            "dbPassword": "admin",
            "dbAutoCreate":true,
            "batchCommit": 100,
            "classes": [
                {"name": "Names","extends": "V"}
            ],
            "indexes": [
                {"class": "Names", "fields":["num:integer"], "type":"UNIQUE"}
            ]
        }
    }
}

oetl

[osboxes@osboxes bin]$ ./oetl.sh ../niloy_data/test.json OrientDB etl v.2.1.13 (build 2.1.x@r9bc1a54a4a62c4de555fc5360357f446f8d2bc84; 2016-03-14 17:00:05+0000) www.orientdb.com

BEGIN ETL PROCESSOR [file]
INFO Reading from file /usr/share/orientdb-community-2.1.13/niloy_data/test.csv with encoding UTF-8 
[orientdb] DEBUG - OrientDBLoader: created vertex class 'Names' extends 'V' [orientdb] DEBUG orientdb: found 0 vertices in class 'null' 
[orientdb] DEBUG orientdb: found metadata field 'null'
[orientdb] DEBUG - OrientDBLoader: created property 'Names.num' of type: integer 
[orientdb] DEBUG - OrientDocumentLoader: created index 'Names.num' type 'UNIQUE' against Class 'Names', fields [num:integer]
[csv] DEBUG document={name:abcd,num:1213} 
[csv] DEBUG document={name:fads,num:725} 
[csv] DEBUG document={name:pyiu,num:9376}
[csv] DEBUG document={name:agido,num:430} 
END ETL PROCESSOR + extracted 4 rows (0 rows/sec) - 4 rows -> loaded 4 vertices (0 vertices/sec) Total time: 556ms [0 warnings, 0 errors]

connect

orientdb {db=test}> list classes

CLASSES
------------------+------------------+------------+----------------+
 NAME             | SUPERCLASS       | CLUSTERS   | RECORDS        |
------------------+------------------+------------+----------------+
 E                |                  | 10         |              0 |
 Names            | [V]              | 11         |              0 |
 OFunction        |                  | 6          |              0 |
 OIdentity        |                  | -          |              0 |
 ORestricted      |                  | -          |              0 |
 ORIDs            |                  | 8          |              0 |
 ORole            | [OIdentity]      | 4          |              3 |
 OSchedule        |                  | 7          |              0 |
 OTriggered       |                  | -          |              0 |
 OUser            | [OIdentity]      | 5          |              3 |
 V                |                  | 9          |              0 |
------------------+------------------+------------+----------------+
 TOTAL = 11       |                  |            |              6 |             
------------------+------------------+------------+----------------+
orientdb {db=test}> bye
Niloy Ray
  • 21
  • 1

1 Answers1

2

Try this:

{
  "source": { "file": { "path": "/usr/share/orientdb-community-2.1.13/niloy_data/test.csv" } },
  "extractor": { "row": {} },
  "transformers": [
    { "csv": {} },
    {"vertex": {"class": "Names"} }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "plocal:/usr/share/orientdb-community-2.1.13/databases/test",
       "dbType": "graph",
       "classes": [
         {"name": "Names","extends": "V"},
       ], "indexes": [
         {"class": "Names", "fields":["num:integer"], "type":"UNIQUE" }
       ]
    }
  }
}

This is the result:

enter image description here

Michela Bonizzi
  • 2,622
  • 1
  • 9
  • 16
  • Hi Michela, It works!!! Thanks so much for your help. One question: in 2.1.4 and later my understanding was that "csv" is deprecated in "transformers" and included in "extractor" - do you know if my understanding is wrong on this ? – Niloy Ray Mar 29 '16 at 14:12
  • Yes, exactly since the 2.1.4 it's deprecated but you can still use it it's not a problem – Michela Bonizzi Mar 30 '16 at 04:22