宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页
  2. 解决办法
  3. 正文

kettle输入组件-JSON Input的使用案例

2020年1月1日 1124点热度 0人点赞 0条评论

用例背景说明

数据文件car_factory.js,其内容如下:

{
    "RECORDS": [
        {
            "factory_id": "10",
            "factory_name": "一汽奔腾",
            "name_index": "Y",
            "picture_path": null
        },
        {
            "factory_id": "107",
            "factory_name": "劳斯莱斯",
            "name_index": "L",
            "picture_path": null
        },
        {
            "factory_id": "108",
            "factory_name": "阿斯顿马丁",
            "name_index": "A",
            "picture_path": null
        },
        {
            "factory_id": "11",
            "factory_name": "一汽马自达",
            "name_index": "Y",
            "picture_path": null
        }
    ]
}

现在要将car_factory.js文件加载到mysql数据库中,数据库对应表DDL:

DROP TABLE IF EXISTS car_factory;
CREATE TABLE car_factory (
 factory_id varchar(45) NOT NULL,
 factory_name varchar(100) DEFAULT NULL,
 name_index varchar(1) DEFAULT NULL,
 picture_path varchar(200) DEFAULT NULL,
 PRIMARY KEY (factory_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

1.整体设计

2.JSON Input Step设置

设置json文件

设置字段映射,注意path的填写方式要遵照jsonpath规则,每一级子对象可以用一个.指代,有关jsonpath的说明,参考http://goessner.net/articles/JsonPath/

数据预览



关于kettle组件说明部分参考网址:http://wiki.pentaho.com/display/EAI/Pentaho+Data+Integration+Steps

kettle官方给出的参考用例:

data-integration\samples\transformations\JsonInput - read a dynamic file.ktr

data-integration\samples\transformations\JsonInput - read a file.ktr

data-integration\samples\transformations\JsonInput - read incoming stream.ktr

原文链接:https://blog.csdn.net/db_guy/article/details/53302832

标签: 暂无
最后更新:2020年1月1日

小渔民

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2