OrientDB从CSV

时间:2016-07-25 20:29:01

标签: csv orientdb

我正在尝试基于CSV,SubSystem和UsedBy中的两列创建两个顶点,其间的列是边(关系)。但每次我运行我的脚本时,我只获得SubSytem下的顶点,并且在UsedBy或Dependency下没有任何内容。任何帮助都是值得赞赏的,对于OrientDB来说相对较新。

{
  "source": { "file": { "path": "CDE-ODS-PROD-VDB-VCDPCDE1-2016-07-18_LVL1.csv" } },
  "extractor": { "row": {} },
  "transformers": [
    { "csv": {"seperator":",",
              "columnsOnFirstLine":true} },
    { "vertex": { "class": "Object" } }
  ],
  "command":{
        "command":"create edge ${input.Dependency} from (select from V where Subsystem=${input.Subsystem} to (select from V where UsedBy = ${input.UsedBy})",
        "output":"edge"
        },
  "loader": {
    "orientdb": {
       "dbURL": "remote:localhost/test",
        "dbUser":"admin",
        "dbPassword":"admin",
       "dbType": "graph",
       "classes": [
         {"name": "Object", "extends": "V"},
         {"name": "UsedBy", "extends": "V"},
         {"name": "Dependency", "extends": "E"} ],
"dbAutoCreate":false,
 "indexes": [
         {"class":"Object", "fields":["Subsystem:string"],"type":"NOTUNIQUE_HASH_INDEX" },
                 {"class":"UsedBy","fields":["UsedBy:string"],"type":"NOTUNIQUE_HASH_INDEX" }

       ]
    }
  }
}

这是示例CSV文件,版本是2.2.5

子系统,依赖关系,使用者,力量 VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.CORE_CONSUMER_DRIVER_PKG.PROCEDURE.PULL_FROM_QUEUE,Code.Method Call,VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.CORE_CONSUMER_DRIVER_PKG.PROCEDURE.PROCESS_UNTIL_QUEUE_IS_EMPTY,1 VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.FX_ORDER_AMOUNT_TSP_PKG.PROCEDURE.LOAD_RECON_ROW_TO_TARGET,Code.Method Call,VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.FX_ORDER_AMOUNT_TSP_PKG.PROCEDURE.RECON_REPAIR_DIFFERENCES,1 VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.FX_ORDER_AMOUNT_TSP_PKG.PROCEDURE.UPSERT_ROW,Code.Method Call,VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.FX_ORDER_AMOUNT_TSP_PKG.PROCEDURE.LOAD_ROW_TO_TARGET,2 VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.UTILITY_PKG.PROCEDURE.RECON_ALL,Code.Method Call,VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.UTILITY_PKG.PROCEDURE.RECON_COMPARE,1 VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.UTILITY_PKG.PROCEDURE.RECON_ALL,Code.Method Call,VCDPCDE1.SCHEMA.CDE_STG.PACKAGE.UTILITY_PKG.PROCEDURE.RECON_REPAIR,1 VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_PORTFOLIO_REF,查询表,VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_ICR_MONTHLY_ACCRUALS_VW,1 VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_PORTFOLIO_REF,查询表,VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_INVOICE_DETAILS_VW,1 VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_PORTFOLIO_REF,查询表,VCDPCDE1.SCHEMA.FOS_TOW.VIEW.FOS_PORTFOLIO_EVENTS_VW,1

我想我让json工作了,但是现在当我试图创建边缘时我得到了这个错误

  

2016-07-29 11:06:05:617 WARNI Transformer [csv]返回null,跳过其余的管道执行[OETLPipeline] [1:csv] DEBUG Transformer输入:VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW ,查询表,VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME,1   [1:csv] DEBUG解析= VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW,查询表,VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME,1   [1:csv] DEBUG document = {Subsystem:VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW,Dependency:Query Table,UsedBy:VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME,Strength:1}   [1:csv] DEBUG Transformer输出:{Subsystem:VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW,Dependency:Query Table,UsedBy:VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME,Strength:1}   [1:command] DEBUG Transformer输入:{Subsystem:VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW,Dependency:Query Table,UsedBy:VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME,Strength:1}   [1:command] DEBUG执行命令=创建边缘查询表(从子系统中选择子系统= VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW到(从UsedBy中选择UsedBy = VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE .GET_ANALYST_DETAIL_BY_NAME)...   管道执行出错:com.orientechnologies.orient.core.sql.OCommandSQLParsingException:解析查询时出错:   创建边缘查询表(从子系统= VCDPCDE1.SCHEMA.CD_DATA.MATERIALIZED VIEW.ORG_PERSON_DTL_MVW中选择对象(从UsedBy中选择UsedBy = VCDPCDE1.SCHEMA.CDE_APP.PACKAGE.RSCH_ORG_HIERARCHY_SSP_PKG.PROCEDURE.GET_ANALYST_DETAIL_BY_NAME)        ^   在第1行第1列遇到“”创建“”。   期待以下之一:       <SELECT> ... <TRAVERSE> ... <MATCH> ... <INSERT> ... <RETURN> ... <PROFILE> ... <FIND> ... <REBUILD> ... <OPTIMIZE> ... <GRANT> ... <REVOKE> ... <BEGIN> ... <COMMIT> ... <IF> ... <SLEEP> ... <CONSOLE> ...      DB name =“test”      DB name =“test”

1 个答案:

答案 0 :(得分:1)

在同一个ETL过程中加载顶点(DependencyObject)时,无法创建边连接(UsedBy)。由于顶点创建仍在进行中,因此无法找到与边连接的顶点。您应该将UsedBy数据分隔到不同的csv文件中并使用包含边创建的第二个json配置文件运行它(Object顶点在这种情况下使用第一个创建ETL运行)。

注意:Used By代替csvUsedBy也有scrollTop