当前位置:网站首页>RestCloud ETL抽取动态库表数据实践
RestCloud ETL抽取动态库表数据实践
2022-06-26 14:51:00 【RestCloud】

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 class ETL_T00005_1INWBJPUXVB implements IETLBaseEvent {
@Override
public String execute(IETLBaseProcessEngine engine, Document modelNodeDoc, Document indoc,String fieldId,String params) throws Exception {
Date date = new Date();
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.查看运行结果

点击库表输出,数据传输统计


感谢您对我们的关注和支持!如需了解更多的功能,请加入RestCloud ETL社区免费下载体验,下载地址:https://etl.restcloud.cn
边栏推荐
- Solution to the upper limit of TeamViewer display devices
- Redis transaction and watch instruction
- It's natural for the landlord to take the rent to repay the mortgage
- 券商经理给的开户链接安全吗?找谁可以开户啊?
- 详解C语言编程题:任意三条边能否构成三角形,输出该三角形面积并判断其类型
- Combat readiness mathematical modeling 31 data interpolation and curve fitting 3
- Kubernetes的pod调度
- Sharing ideas for a quick switch to an underlying implementation
- Pod of kubernetes
- 15 BS object Node name Node name String get nested node content
猜你喜欢

How to mount cloud disks in ECS

关于 selenium.common.exceptions.WebDriverException: Message: An unknown server-side error 解决方案(已解决)

乐鑫 AWS IoT ExpressLink 模组达到通用可用性

Halcon C # sets the form font and adaptively displays pictures

Attention meets geometry: geometry guided spatiotemporal attention consistency self supervised monocular depth estimation

710. random numbers in the blacklist

Mark: unity3d cannot select resources in the inspector, that is, project locking

【soloπ】adb连接单个多个手机

程序分析与优化 - 8 寄存器分配

Halcon C# 设置窗体字体,自适应显示图片
随机推荐
Unity UnityWebRequest 下载封装
Is it safe to open a stock account with the account manager online??
TCP拥塞控制详解 | 1. 概述
Use of subqueries
文献1
R language uses the aggregate function of epidisplay package to split numerical variables into different subsets based on factor variables, calculate the summary statistics of each subset, and use agg
大学生值得珍藏的实用网站推荐
信息学奥赛一本通 1400:统计单词数 (字符串匹配)
Numpy基本使用
R语言使用ggplot2可视化泊松回归模型(Poisson Regression)的结果、可视化不同参量组合下的计数结果
详解C语言编程题:任意三条边能否构成三角形,输出该三角形面积并判断其类型
R语言epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布、使用cex.X.axis参数指定X轴轴刻度数值标签字体的大小
The engine "node" is inconsistent with this module
Kubernetes的pod
Authoritative announcement on the recruitment of teachers in Yan'an University in 2022
Mathematical modeling of war preparation 30 regression analysis 2
The JVM outputs GC logs, causing the JVM to get stuck. I am stupid
The intersect function in the dplyr package of R language obtains the data lines that exist in both dataframes and the data lines that cross the two dataframes
710. 黑名单中的随机数
Electron