当前位置:网站首页>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.查看运行结果
点击库表输出,数据传输统计
边栏推荐
- Management system permission design
- Elastic searchable snapshot function (frozen Tier 3)
- TRCT test cloud + article online speed
- CentOS 7 installing SQL server2017 (Linux)
- Litamin: SLAM Based on geometric approximation of normal distribution
- Use py-mysql2pgsql to synchronize MySQL data to Greenplum
- Tiktok Kwai, e-commerce enters the same river
- Customizing security groups using BPF
- 这个巡检平台你还不知道,真是亏大了!
- 03. Tencent cloud IOT device side learning -- overview of mqtt control package
猜你喜欢

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
Issue 39: MySQL time class partition write SQL considerations
About swagger
SQL basic tutorial (learning notes)

How to create simple shapes in illustrator 2022
Using consistent hash algorithm in Presto to enhance the data cache locality of dynamic clusters

Mengyou Technology: tiktok current limiting? Teach you to create popular copywriting + popular background music selection

NVM download, installation and use

Etching process flow for PCB fabrication

Constantly changing the emergency dialing of harmonyos ETS during the new year
随机推荐
[MySQL practice] binlog, a sharp tool for problem analysis
[log service CLS] Tencent cloud game battle engine mgobe accesses CLS
04. Tencent cloud IOT device side learning - network connection and device authentication
Operation and maintenance guide | cos back source setting practice
FPGA systematic learning notes serialization_ Day10 [sequential logic, competitive adventure, synchronous reset, asynchronous reset]
A comprehensive understanding of fiber to home FTTH and optical splitter
AFG EDI requirements details
基于BGP实现纯三层容器网络方案
Analysis of signal preemptive scheduling based on go language from source code
Dunhuang Research Institute and Tencent have launched a new strategic cooperation to take you around the digital new silk road with AI
Leveldb source code analysis -- version management
Cloud native monitoring practice (2) monitoring and collection of components outside the TKE cluster
How to build RTSP test URL in Intranet Environment
H265/webvr video web page without plug-in player easyplayer Solution to the problem of cumulative delay of FLV video played by JS
QQ domain name detection API interface sharing (with internal access automatic jump PHP code)
Explanation of pod DNS configuration & cases of DNS resolution failure
[DB Bao 45] MySQL highly available mgr+consult architecture deployment
A tutorial on how the zblog system obtains user related information based on user ID
Elastic searchable snapshot function (frozen Tier 3)
Quick view of product trends in February 2021