当前位置:网站首页>RestCloud ETL抽取动态库表数据实践
RestCloud ETL抽取动态库表数据实践
2022-06-24 17:35:00 【用户8905905】
RestCloud ETL社区版是一款数据集成工具,提供可视化多数据管道构建、数据源管理、运行监控及权限管理功能。
1.场景说明:
对于一些业务系统每天运行自动产生一张新数据表,希望通过1条数据流程每天自动读取当天的数据表。如2022年6月1日产生表名称为“table_20220601”,2022年6月2日产生表名称为“table_20220602”,以此类推;对于这样的动态表,如何使用RestCloud ETL简单、便捷实现数据抽取。
2.实现原理:
首先我们需要根据日期自动生成对于的表名称,并做将该参数传输给库表输入组件。实现流程图如下:
实现该业务的前提条件是库表输入组件支持接收变量传输,这个RestCloud ETL无与伦比的优势。
3.实现步骤:
3.1配置"执行Java脚本"
右键"执行Java脚本",点击“节点属性”打开配置编辑页面,点击下一步,编辑Java代码。代码中加入生成表名称代码,输出参数为: p_tablename ,如下图:
代码如下:
package cn.restcloud.etl.rule.ext;
import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import java.sql.Connection;
import cn.restcloud.framework.core.context.*;
import cn.restcloud.etl.base.IETLBaseEvent;
import cn.restcloud.etl.base.IETLBaseProcessEngine;
import cn.restcloud.framework.core.util.*;
import cn.restcloud.framework.core.util.db.rdb.*;
import java.util.*;
import java.text.SimpleDateFormat;
/**
indoc为流数据
执行成功必须返回字符1,返回0表示终止流程
*/
public classETL_T00005_1INWBJPUXVB implements IETLBaseEvent {
@Override
public String execute(IETLBaseProcessEngine engine, Document modelNodeDoc, Document indoc,String fieldId,String params) throws Exception {
Date date = newDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String table = "table_" + sdf.format(date);
PrintUtil.o(table);
indoc.put("p_tablename",table);
return "1";
}
}
完成代码编辑,点击【编译并保存】退出配置。
3.2 库表输入配置
右键"库表输入",点击“节点属性”打开配置编辑页面。
选择源表数据源,点击下一步:
编辑读取数据SQL语句,select * from 表名称,表名称输入接收参数,参数格式:${参数},${p_tablename},点击下一步:
点击【新增字段】,输入抽取数据表字段,点击保存完成配置。
3.3 库表输出配置
右键"库表输入",点击“节点属性”打开配置编辑页面。
依次输入配置,选择数据源,载入数据库表,选择数据库表。
点击【从表中读入】,勾选关键字(主键),点击下一步。
根据需要选择对应的日记策略,点击保存完成配置。
4.运行测试
点击【运行】
点击【开始运行】
5.查看运行结果
点击库表输出,数据传输统计
边栏推荐
- A solution to the problem that the separator of WordPress title - is escaped as -
- On N handshakes and M waves of TCP
- [play with Tencent cloud] TSF User Guide
- How to troubleshoot and solve the problem that the ultra-low delay security live broadcast system webrtc client plays no audio in the browser?
- 2. Leveldb design principle -- LSM
- Users of the Tiktok open platform are authorized to obtain the user's fan statistics and short video data
- How to learn go language happily? Let's go!
- Use cloud development to make a login free resource navigation applet!
- Redis source code analysis RDB
- 03. Tencent cloud IOT device side learning -- overview of mqtt control package
猜你喜欢

NVM download, installation and use

Error reported after NPM I

How to decompile APK files

The 'ng' entry cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Check the spelling of the name. If you include a path, make sure the path is correct, and then
Using flex to implement common layouts

LC 300. Longest increasing subsequence

Etching process flow for PCB fabrication

Constantly changing the emergency dialing of harmonyos ETS during the new year

How to create simple shapes in illustrator 2022
About swagger
随机推荐
专有云TCE COS新一代存储引擎YottaStore介绍
C language | logical operators
How to use rdbtools to analyze redis large keys
Zabix5.0-0 - agent2 monitoring MariaDB database (Linux based)
Contributed code to famous projects for the first time, a little nervous
PHP WMI get hostname
Using flex to implement common layouts
Why do you develop middleware when you are young? "You can choose your own way"
When the game meets NFT, is it "chicken ribs" or "chicken legs"?
Will the easycvr video channel of the urban intelligent video monitoring image analysis platform occupy bandwidth after stopping playing?
A comprehensive understanding of fiber to home FTTH and optical splitter
About swagger
Development of block hash game guessing system (mature code)
Go language GC implementation principle and source code analysis
How to decompile APK files
VBA Daniel used the nested loop
A set of IM architecture technology dry goods for 100 million users (Part 2): reliability, orderliness, weak network optimization, etc
Uncover the secrets of Tencent R & D! 30% of the demand will be responded within 1 day!
-Bash: wget: command not found
Industrial security experts talk about DDoS countermeasures from the perspective of attack and defense