当前位置:网站首页>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
边栏推荐
- Kubernetes的pod
- R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
- Practical website recommendations worth collecting for College Students
- Stream常用操作以及原理探索
- 710. random numbers in the blacklist
- Pytorch深度学习代码技巧
- MHA high availability coordination and failover
- 信息学奥赛一本通 1400:统计单词数 (字符串匹配)
- 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
- 大学生值得珍藏的实用网站推荐
猜你喜欢

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

Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution

Redis-集群

TCP拥塞控制详解 | 1. 概述

这才是优美的文件系统挂载方式,亲测有效

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

Bank of Beijing x Huawei: network intelligent operation and maintenance tamps the base of digital transformation service

聊聊 RPA 方向的规划:简单有价值的事情长期坚持做

使用卷积对数据进行平滑处理

15 BS object Node name Node name String get nested node content
随机推荐
TCP 复位攻击原理
Unity 利用Skybox Panoramic着色器制作全景图预览有条缝隙问题解决办法
Notes on writing questions in C language -- table tennis competition
Unity C# 网络学习(十)——UnityWebRequest(二)
挖财注册开户安全吗,有没有什么风险?
[async/await] - the final solution of asynchronous programming
View touch analysis
Common operation and Principle Exploration of stream
Informatics Olympiad all in one 1400: count the number of words (string matching)
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
【使用yarn运行报错】The engine “node“ is incompatible with this module.
R language uses ggplot2 to visualize the results of Poisson regression model and count results under different parameter combinations
R language uses GLM function to build Poisson logarithm linear regression model, processes three-dimensional contingency table data to build saturation model, uses step function to realize stepwise re
It's natural for the landlord to take the rent to repay the mortgage
重磅白皮书发布,华为持续引领未来智慧园区建设新模式
Stream常用操作以及原理探索
Optimizing for vectorization
TCP congestion control details | 1 summary
使用卷积对数据进行平滑处理
Naacl2022: (code practice) good visual guidance promotes better feature extraction, multimodal named entity recognition (with source code download)