当前位置:网站首页>RestCloud ETL抽取動態庫錶數據實踐
RestCloud ETL抽取動態庫錶數據實踐
2022-06-26 15:04: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
边栏推荐
- Deploy the flask environment using the pagoda panel
- Datasets dataset class (2)
- This is the graceful file system mounting method, which is effective through personal testing
- 15 BS object Node name Node name String get nested node content
- Go变量的声明与赋值
- SAP 销售数据 实际发货数据导出 销量
- Execution of commands in the cluster
- feil_uVission4左侧工目录消失
- Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution
- 权威发布 | 延安大学2022年教师岗位招聘公告
猜你喜欢

10分钟了解BIM+GIS融合,常见BIM数据格式及特性

TS common data types summary

详解C语言编程题:任意三条边能否构成三角形,输出该三角形面积并判断其类型

VMware partial settings

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

Document 1

MySQL master-slave replication and read-write separation

15 bs对象.节点名称.节点名称.string 获取嵌套节点内容

Get the intersection union difference set of two dataframes

TCP congestion control details | 1 summary
随机推荐
R language GLM function logistic regression model, using epidisplay package logistic The display function obtains the summary statistical information of the model (initial and adjusted odds ratio and
View触摸分析
Halcon C # sets the form font and adaptively displays pictures
15 BS object Node name Node name String get nested node content
The JVM outputs GC logs, causing the JVM to get stuck. I am stupid
Complimentary Book Cognitive Control: how does our brain accomplish tasks?
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器
Program analysis and Optimization - 8 register allocation
Unity C# 网络学习(九)——WWWFrom
Deploy the flask environment using the pagoda panel
NAACL2022:(代码实践)好的视觉引导促进更好的特征提取,多模态命名实体识别(附源代码下载)...
聊聊 RPA 方向的规划:简单有价值的事情长期坚持做
710. 黑名单中的随机数
Excel-vba quick start (II. Condition judgment and circulation)
R语言epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布、使用cex.X.axis参数指定X轴轴刻度数值标签字体的大小
Pytorch深度学习代码技巧
Redis cluster messages
Attention meets Geometry:几何引导的时空注意一致性自监督单目深度估计
Stream常用操作以及原理探索
Solution to the upper limit of TeamViewer display devices