add workflow 天润Smart-ccc客户数据,dev
This commit is contained in:
parent
0eafd90272
commit
8d1a4021f0
|
@ -0,0 +1,98 @@
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS p20_pdm.t01_ccc_cust_info;
|
||||||
|
CREATE TABLE IF NOT EXISTS p20_pdm.t01_ccc_cust_info (
|
||||||
|
id varchar(10)
|
||||||
|
, name varchar(20)
|
||||||
|
, sex varchar(10)
|
||||||
|
, tel text
|
||||||
|
, email varchar(100)
|
||||||
|
, address text
|
||||||
|
, level varchar(10)
|
||||||
|
, share_type varchar(10)
|
||||||
|
, share varchar(10)
|
||||||
|
, remark text
|
||||||
|
, source varchar(10)
|
||||||
|
, creator_type varchar(10)
|
||||||
|
, creator_id varchar(10)
|
||||||
|
, modifier_type varchar(10)
|
||||||
|
, modifier_id varchar(10)
|
||||||
|
, last_contact_time timestamp(0)
|
||||||
|
, last_contact_type varchar(10)
|
||||||
|
, customize text
|
||||||
|
, create_time timestamp(0)
|
||||||
|
, update_time timestamp(0)
|
||||||
|
, visitor_ids text
|
||||||
|
, creator_name varchar(20)
|
||||||
|
, modifier_name varchar(20)
|
||||||
|
, ib_bridged_number int
|
||||||
|
, ob_bridged_number int
|
||||||
|
, ob_number int
|
||||||
|
, assign_time varchar(20)
|
||||||
|
, external_id varchar(100)
|
||||||
|
, ib_number int
|
||||||
|
, retrieve char(1)
|
||||||
|
, retrieve_time varchar(20)
|
||||||
|
, queue_without_attribution text
|
||||||
|
, phase_id varchar(10)
|
||||||
|
, phase_reason_id varchar(10)
|
||||||
|
, promote_source varchar(20)
|
||||||
|
, repeat_promote_count int
|
||||||
|
, last_repeat_promote_time timestamp(0)
|
||||||
|
, label_ids text
|
||||||
|
, Etl_Batch_No varchar(50)
|
||||||
|
, Etl_First_Dt timestamp(0)
|
||||||
|
, Etl_Job varchar(200)
|
||||||
|
, Etl_Proc_Dt timestamp(0)
|
||||||
|
, Etl_Tx_Dt timestamp(0)
|
||||||
|
, Src_Sysname varchar(50)
|
||||||
|
, Src_Table varchar(50)
|
||||||
|
,primary key( id )
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.id IS '客户资料id';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.name IS '客户名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.sex IS '客户性别';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.tel IS '客户号码';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.email IS '邮箱';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.address IS '地址';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.level IS '客户等级';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.share_type IS '归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.share IS '客户归属';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.remark IS '备注';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.source IS '客户来源';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.creator_type IS '创建人类型';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.creator_id IS '创建人id,-1:openApi';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.modifier_type IS '更新人类型';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.modifier_id IS '更新人id,-1:openApi';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.last_contact_time IS '最后一次联系时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.last_contact_type IS '最后一次联系类型';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.customize IS '该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.create_time IS '创建时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.update_time IS '更新时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.visitor_ids IS '访客ids';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.creator_name IS '创建人名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.modifier_name IS '更新人名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.ib_bridged_number IS '呼入接通次数';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.ob_bridged_number IS '呼出接通次数';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.ob_number IS '呼出次数';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.assign_time IS '分配时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.external_id IS '外部企业客户ID (第三方平台 ID)';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.ib_number IS '呼入次数';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.retrieve IS '是否为回收客户';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.retrieve_time IS '回收时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.queue_without_attribution IS '无归属授权员工组';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.phase_id IS '客户阶段id';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.phase_reason_id IS '阶段原因id';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.promote_source IS '推广来源';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.repeat_promote_count IS '重复推广次数';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.last_repeat_promote_time IS '最近一次重复推广时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.label_ids IS '客户标签id';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Etl_Batch_No IS '作业批次号';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Etl_First_Dt IS '最初入库时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Etl_Job IS '作业名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Etl_Proc_Dt IS '本次入库时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Etl_Tx_Dt IS '作业运行时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Src_Sysname IS '来源系统';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_info.Src_Table IS '来源表';
|
||||||
|
|
||||||
|
COMMENT ON TABLE p20_pdm.t01_ccc_cust_info IS 'smartccc客户信息';
|
|
@ -0,0 +1,469 @@
|
||||||
|
/***************************************************************************************************/
|
||||||
|
/*script in Sql, generate by SdmCreateScript 2020(by Qihang Feng, QF255001@TERADATA.COM) */
|
||||||
|
/*VERSION 01.10 revised on 2020-08-25 */
|
||||||
|
/*Brilliance stems from wisdoms. */
|
||||||
|
/*************Head Section**************************************************************************/
|
||||||
|
/*Script Use: Periodically load data to :t01_ccc_cust_info(smartccc客户信息) */
|
||||||
|
/*Create Date:2024-07-08 18:26:45 */
|
||||||
|
/*SDM Developed By: dev */
|
||||||
|
/*SDM Developed Date: 2024-07-08 */
|
||||||
|
/*SDM Checked By: dev */
|
||||||
|
/*SDM Checked Date: 2024-07-08 */
|
||||||
|
/*Script Developed By: dev */
|
||||||
|
/*Script Checked By: dev */
|
||||||
|
/*Source table 1: p10_sa.s98_s_tr_custom_details */
|
||||||
|
/*Job Type: Inbound transform (Tier 1 to Tier 2) */
|
||||||
|
/*Target Table:t01_ccc_cust_info */
|
||||||
|
/*ETL Job Name:t01_ccc_cust_info */
|
||||||
|
/*ETL Frequency:Daily */
|
||||||
|
/*ETL Policy:F2 */
|
||||||
|
/********************************************************************************************/
|
||||||
|
/*******Main Section**************************************************************************/
|
||||||
|
\set ON_ERROR_STOP on
|
||||||
|
\set AUTOCOMMIT on
|
||||||
|
\timing on
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*创建临时表加载当前数据 */
|
||||||
|
CREATE TEMPORARY TABLE t01_ccc_cust_info_agi_CUR_I
|
||||||
|
( LIKE :PDMDB.t01_ccc_cust_info)
|
||||||
|
ON COMMIT PRESERVE ROWS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*创建临时表加载不同数据 */
|
||||||
|
CREATE TEMPORARY TABLE t01_ccc_cust_info_agi_INS
|
||||||
|
( LIKE :PDMDB.t01_ccc_cust_info)
|
||||||
|
ON COMMIT PRESERVE ROWS;
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************************************/
|
||||||
|
/* GROUP 1:Source Table:s98_s_tr_custom_details*******************************************************/
|
||||||
|
/*****************************************************************************************************/
|
||||||
|
INSERT INTO t01_ccc_cust_info_agi_CUR_I (
|
||||||
|
id /*客户资料id*/
|
||||||
|
,name /*客户名称*/
|
||||||
|
,sex /*客户性别*/
|
||||||
|
,tel /*客户号码*/
|
||||||
|
,email /*邮箱*/
|
||||||
|
,address /*地址*/
|
||||||
|
,level /*客户等级*/
|
||||||
|
,share_type /*归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属*/
|
||||||
|
,share /*客户归属*/
|
||||||
|
,remark /*备注*/
|
||||||
|
,source /*客户来源*/
|
||||||
|
,creator_type /*创建人类型*/
|
||||||
|
,creator_id /*创建人id,-1:openApi*/
|
||||||
|
,modifier_type /*更新人类型*/
|
||||||
|
,modifier_id /*更新人id,-1:openApi*/
|
||||||
|
,last_contact_time /*最后一次联系时间*/
|
||||||
|
,last_contact_type /*最后一次联系类型*/
|
||||||
|
,customize /*该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值*/
|
||||||
|
,create_time /*创建时间*/
|
||||||
|
,update_time /*更新时间*/
|
||||||
|
,visitor_ids /*访客ids*/
|
||||||
|
,creator_name /*创建人名称*/
|
||||||
|
,modifier_name /*更新人名称*/
|
||||||
|
,ib_bridged_number /*呼入接通次数*/
|
||||||
|
,ob_bridged_number /*呼出接通次数*/
|
||||||
|
,ob_number /*呼出次数*/
|
||||||
|
,assign_time /*分配时间*/
|
||||||
|
,external_id /*外部企业客户ID (第三方平台 ID)*/
|
||||||
|
,ib_number /*呼入次数*/
|
||||||
|
,retrieve /*是否为回收客户*/
|
||||||
|
,retrieve_time /*回收时间*/
|
||||||
|
,queue_without_attribution /*无归属授权员工组*/
|
||||||
|
,phase_id /*客户阶段id*/
|
||||||
|
,phase_reason_id /*阶段原因id*/
|
||||||
|
,promote_source /*推广来源*/
|
||||||
|
,repeat_promote_count /*重复推广次数*/
|
||||||
|
,last_repeat_promote_time /*最近一次重复推广时间*/
|
||||||
|
,label_ids /*客户标签id*/
|
||||||
|
,Etl_Batch_No /*作业批次号*/
|
||||||
|
,Etl_First_Dt /*最初入库时间*/
|
||||||
|
,Etl_Job /*作业名称*/
|
||||||
|
,Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,Src_Sysname /*来源系统*/
|
||||||
|
,Src_Table /*来源表*/
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
COALESCE(TRIM(CAST(p0.id AS varchar(10))),'') /*id*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.name AS varchar(20))),'') /*name*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.sex AS varchar(10))),'') /*sex*/
|
||||||
|
,COALESCE(TRIM(p0.tel),'') /*tel*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.email AS varchar(100))),'') /*email*/
|
||||||
|
,COALESCE(TRIM(p0.address),'') /*address*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.level AS varchar(10))),'') /*level*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.share_type AS varchar(10))),'') /*share_type*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.share AS varchar(10))),'') /*share*/
|
||||||
|
,COALESCE(TRIM(p0.remark),'') /*remark*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.source AS varchar(10))),'') /*source*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.creator_type AS varchar(10))),'') /*creator_type*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.creator_id AS varchar(10))),'') /*creator_id*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.modifier_type AS varchar(10))),'') /*modifier_type*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.modifier_id AS varchar(10))),'') /*modifier_id*/
|
||||||
|
, to_timestamp(p0.last_contact_time::bigint/1000)::timestamp(0) /*last_contact_time*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.last_contact_type AS varchar(10))),'') /*last_contact_type*/
|
||||||
|
,COALESCE(TRIM(p0.customize),'') /*customize*/
|
||||||
|
,to_timestamp(p0.create_time::bigint/1000)::timestamp(0) /*create_time*/
|
||||||
|
,to_timestamp(p0.update_time::bigint/1000)::timestamp(0) /*update_time*/
|
||||||
|
,COALESCE(TRIM(p0.visitor_ids),'') /*visitor_ids*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.creator_name AS varchar(20))),'') /*creator_name*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.modifier_name AS varchar(20))),'') /*modifier_name*/
|
||||||
|
,COALESCE(CAST(p0.ib_bridged_number AS int),0) /*ib_bridged_number*/
|
||||||
|
,COALESCE(CAST(p0.ob_bridged_number AS int),0) /*ob_bridged_number*/
|
||||||
|
,COALESCE(CAST(p0.ob_number AS int),0) /*ob_number*/
|
||||||
|
,to_timestamp(p0.assign_time::bigint/1000)::timestamp(0) /*assign_time*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.external_id AS varchar(100))),'') /*external_id*/
|
||||||
|
,COALESCE(CAST(p0.ib_number AS int),0) /*ib_number*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.retrieve AS char(1))),'') /*retrieve*/
|
||||||
|
,to_timestamp(p0.retrieve_time::bigint/1000)::timestamp(0) /*retrieve_time*/
|
||||||
|
,COALESCE(TRIM(p0.queue_without_attribution),'') /*queue_without_attribution*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.phase_id AS varchar(10))),'') /*phase_id*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.phase_reason_id AS varchar(10))),'') /*phase_reason_id*/
|
||||||
|
,COALESCE(TRIM(CAST(p0.promote_source AS varchar(20))),'') /*promote_source*/
|
||||||
|
,COALESCE(CAST(p0.repeat_promote_count AS int),0) /*repeat_promote_count*/
|
||||||
|
,to_timestamp(p0.last_repeat_promote_time::bigint/1000)::timestamp(0) /*last_repeat_promote_time*/
|
||||||
|
,COALESCE(TRIM(p0.label_ids),'') /*label_ids*/
|
||||||
|
,0 /*Etl_Batch_No*/
|
||||||
|
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/
|
||||||
|
,:ETLJOB /*Etl_Job*/
|
||||||
|
,current_timestamp(0) /*Etl_Proc_Dt*/
|
||||||
|
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_Tx_Dt*/
|
||||||
|
,Substr('s98_s_tr_custom_details',1,3) /*Src_Sysname*/
|
||||||
|
,'s98_s_tr_custom_details' /*Src_Table*/
|
||||||
|
|
||||||
|
FROM p10_sa.s98_s_tr_custom_details p0
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*将不同数据插入到临时表 */
|
||||||
|
;INSERT INTO t01_ccc_cust_info_agi_INS (
|
||||||
|
name /*客户名称*/
|
||||||
|
,sex /*客户性别*/
|
||||||
|
,tel /*客户号码*/
|
||||||
|
,email /*邮箱*/
|
||||||
|
,address /*地址*/
|
||||||
|
,level /*客户等级*/
|
||||||
|
,share_type /*归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属*/
|
||||||
|
,share /*客户归属*/
|
||||||
|
,remark /*备注*/
|
||||||
|
,source /*客户来源*/
|
||||||
|
,creator_type /*创建人类型*/
|
||||||
|
,creator_id /*创建人id,-1:openApi*/
|
||||||
|
,modifier_type /*更新人类型*/
|
||||||
|
,modifier_id /*更新人id,-1:openApi*/
|
||||||
|
,last_contact_time /*最后一次联系时间*/
|
||||||
|
,last_contact_type /*最后一次联系类型*/
|
||||||
|
,customize /*该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值*/
|
||||||
|
,create_time /*创建时间*/
|
||||||
|
,update_time /*更新时间*/
|
||||||
|
,visitor_ids /*访客ids*/
|
||||||
|
,creator_name /*创建人名称*/
|
||||||
|
,modifier_name /*更新人名称*/
|
||||||
|
,ib_bridged_number /*呼入接通次数*/
|
||||||
|
,ob_bridged_number /*呼出接通次数*/
|
||||||
|
,ob_number /*呼出次数*/
|
||||||
|
,assign_time /*分配时间*/
|
||||||
|
,external_id /*外部企业客户ID (第三方平台 ID)*/
|
||||||
|
,ib_number /*呼入次数*/
|
||||||
|
,retrieve /*是否为回收客户*/
|
||||||
|
,retrieve_time /*回收时间*/
|
||||||
|
,queue_without_attribution /*无归属授权员工组*/
|
||||||
|
,phase_id /*客户阶段id*/
|
||||||
|
,phase_reason_id /*阶段原因id*/
|
||||||
|
,promote_source /*推广来源*/
|
||||||
|
,repeat_promote_count /*重复推广次数*/
|
||||||
|
,last_repeat_promote_time /*最近一次重复推广时间*/
|
||||||
|
,label_ids /*客户标签id*/
|
||||||
|
,id /*客户资料id*/
|
||||||
|
,Etl_Batch_No /*作业批次号*/
|
||||||
|
,Etl_First_Dt /*最初入库时间*/
|
||||||
|
,Etl_Job /*作业名称*/
|
||||||
|
,Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,Src_Sysname /*来源系统*/
|
||||||
|
,Src_Table /*来源表*/
|
||||||
|
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
P1.name /*客户名称*/
|
||||||
|
,P1.sex /*客户性别*/
|
||||||
|
,P1.tel /*客户号码*/
|
||||||
|
,P1.email /*邮箱*/
|
||||||
|
,P1.address /*地址*/
|
||||||
|
,P1.level /*客户等级*/
|
||||||
|
,P1.share_type /*归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属*/
|
||||||
|
,P1.share /*客户归属*/
|
||||||
|
,P1.remark /*备注*/
|
||||||
|
,P1.source /*客户来源*/
|
||||||
|
,P1.creator_type /*创建人类型*/
|
||||||
|
,P1.creator_id /*创建人id,-1:openApi*/
|
||||||
|
,P1.modifier_type /*更新人类型*/
|
||||||
|
,P1.modifier_id /*更新人id,-1:openApi*/
|
||||||
|
,P1.last_contact_time /*最后一次联系时间*/
|
||||||
|
,P1.last_contact_type /*最后一次联系类型*/
|
||||||
|
,P1.customize /*该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值*/
|
||||||
|
,P1.create_time /*创建时间*/
|
||||||
|
,P1.update_time /*更新时间*/
|
||||||
|
,P1.visitor_ids /*访客ids*/
|
||||||
|
,P1.creator_name /*创建人名称*/
|
||||||
|
,P1.modifier_name /*更新人名称*/
|
||||||
|
,P1.ib_bridged_number /*呼入接通次数*/
|
||||||
|
,P1.ob_bridged_number /*呼出接通次数*/
|
||||||
|
,P1.ob_number /*呼出次数*/
|
||||||
|
,P1.assign_time /*分配时间*/
|
||||||
|
,P1.external_id /*外部企业客户ID (第三方平台 ID)*/
|
||||||
|
,P1.ib_number /*呼入次数*/
|
||||||
|
,P1.retrieve /*是否为回收客户*/
|
||||||
|
,P1.retrieve_time /*回收时间*/
|
||||||
|
,P1.queue_without_attribution /*无归属授权员工组*/
|
||||||
|
,P1.phase_id /*客户阶段id*/
|
||||||
|
,P1.phase_reason_id /*阶段原因id*/
|
||||||
|
,P1.promote_source /*推广来源*/
|
||||||
|
,P1.repeat_promote_count /*重复推广次数*/
|
||||||
|
,P1.last_repeat_promote_time /*最近一次重复推广时间*/
|
||||||
|
,P1.label_ids /*客户标签id*/
|
||||||
|
,P1.id /*客户资料id*/
|
||||||
|
,P1.Etl_Batch_No /*作业批次号*/
|
||||||
|
,P1.Etl_First_Dt /*最初入库时间*/
|
||||||
|
,P1.Etl_Job /*作业名称*/
|
||||||
|
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,P1.Src_Sysname /*来源系统*/
|
||||||
|
,P1.Src_Table /*来源表*/
|
||||||
|
|
||||||
|
FROM t01_ccc_cust_info_agi_CUR_I P1
|
||||||
|
LEFT JOIN :PDMDB.t01_ccc_cust_info P2
|
||||||
|
ON P1.name = P2.name
|
||||||
|
AND P1.sex = P2.sex
|
||||||
|
AND P1.tel = P2.tel
|
||||||
|
AND P1.email = P2.email
|
||||||
|
AND P1.address = P2.address
|
||||||
|
AND P1.level = P2.level
|
||||||
|
AND P1.share_type = P2.share_type
|
||||||
|
AND P1.share = P2.share
|
||||||
|
AND P1.remark = P2.remark
|
||||||
|
AND P1.source = P2.source
|
||||||
|
AND P1.creator_type = P2.creator_type
|
||||||
|
AND P1.creator_id = P2.creator_id
|
||||||
|
AND P1.modifier_type = P2.modifier_type
|
||||||
|
AND P1.modifier_id = P2.modifier_id
|
||||||
|
AND P1.last_contact_time = P2.last_contact_time
|
||||||
|
AND P1.last_contact_type = P2.last_contact_type
|
||||||
|
AND P1.customize = P2.customize
|
||||||
|
AND P1.create_time = P2.create_time
|
||||||
|
AND P1.update_time = P2.update_time
|
||||||
|
AND P1.visitor_ids = P2.visitor_ids
|
||||||
|
AND P1.creator_name = P2.creator_name
|
||||||
|
AND P1.modifier_name = P2.modifier_name
|
||||||
|
AND P1.ib_bridged_number = P2.ib_bridged_number
|
||||||
|
AND P1.ob_bridged_number = P2.ob_bridged_number
|
||||||
|
AND P1.ob_number = P2.ob_number
|
||||||
|
AND P1.assign_time = P2.assign_time
|
||||||
|
AND P1.external_id = P2.external_id
|
||||||
|
AND P1.ib_number = P2.ib_number
|
||||||
|
AND P1.retrieve = P2.retrieve
|
||||||
|
AND P1.retrieve_time = P2.retrieve_time
|
||||||
|
AND P1.queue_without_attribution = P2.queue_without_attribution
|
||||||
|
AND P1.phase_id = P2.phase_id
|
||||||
|
AND P1.phase_reason_id = P2.phase_reason_id
|
||||||
|
AND P1.promote_source = P2.promote_source
|
||||||
|
AND P1.repeat_promote_count = P2.repeat_promote_count
|
||||||
|
AND P1.last_repeat_promote_time = P2.last_repeat_promote_time
|
||||||
|
AND P1.label_ids = P2.label_ids
|
||||||
|
AND P1.id = P2.id
|
||||||
|
|
||||||
|
WHERE P2.name IS NULL
|
||||||
|
OR P2.sex IS NULL
|
||||||
|
OR P2.tel IS NULL
|
||||||
|
OR P2.email IS NULL
|
||||||
|
OR P2.address IS NULL
|
||||||
|
OR P2.level IS NULL
|
||||||
|
OR P2.share_type IS NULL
|
||||||
|
OR P2.share IS NULL
|
||||||
|
OR P2.remark IS NULL
|
||||||
|
OR P2.source IS NULL
|
||||||
|
OR P2.creator_type IS NULL
|
||||||
|
OR P2.creator_id IS NULL
|
||||||
|
OR P2.modifier_type IS NULL
|
||||||
|
OR P2.modifier_id IS NULL
|
||||||
|
OR P2.last_contact_time IS NULL
|
||||||
|
OR P2.last_contact_type IS NULL
|
||||||
|
OR P2.customize IS NULL
|
||||||
|
OR P2.create_time IS NULL
|
||||||
|
OR P2.update_time IS NULL
|
||||||
|
OR P2.visitor_ids IS NULL
|
||||||
|
OR P2.creator_name IS NULL
|
||||||
|
OR P2.modifier_name IS NULL
|
||||||
|
OR P2.ib_bridged_number IS NULL
|
||||||
|
OR P2.ob_bridged_number IS NULL
|
||||||
|
OR P2.ob_number IS NULL
|
||||||
|
OR P2.assign_time IS NULL
|
||||||
|
OR P2.external_id IS NULL
|
||||||
|
OR P2.ib_number IS NULL
|
||||||
|
OR P2.retrieve IS NULL
|
||||||
|
OR P2.retrieve_time IS NULL
|
||||||
|
OR P2.queue_without_attribution IS NULL
|
||||||
|
OR P2.phase_id IS NULL
|
||||||
|
OR P2.phase_reason_id IS NULL
|
||||||
|
OR P2.promote_source IS NULL
|
||||||
|
OR P2.repeat_promote_count IS NULL
|
||||||
|
OR P2.last_repeat_promote_time IS NULL
|
||||||
|
OR P2.label_ids IS NULL
|
||||||
|
OR P2.id IS NULL
|
||||||
|
|
||||||
|
;
|
||||||
|
/*将新增数据插入到目标表 */
|
||||||
|
;INSERT INTO :PDMDB.t01_ccc_cust_info (
|
||||||
|
name /*客户名称*/
|
||||||
|
,sex /*客户性别*/
|
||||||
|
,tel /*客户号码*/
|
||||||
|
,email /*邮箱*/
|
||||||
|
,address /*地址*/
|
||||||
|
,level /*客户等级*/
|
||||||
|
,share_type /*归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属*/
|
||||||
|
,share /*客户归属*/
|
||||||
|
,remark /*备注*/
|
||||||
|
,source /*客户来源*/
|
||||||
|
,creator_type /*创建人类型*/
|
||||||
|
,creator_id /*创建人id,-1:openApi*/
|
||||||
|
,modifier_type /*更新人类型*/
|
||||||
|
,modifier_id /*更新人id,-1:openApi*/
|
||||||
|
,last_contact_time /*最后一次联系时间*/
|
||||||
|
,last_contact_type /*最后一次联系类型*/
|
||||||
|
,customize /*该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值*/
|
||||||
|
,create_time /*创建时间*/
|
||||||
|
,update_time /*更新时间*/
|
||||||
|
,visitor_ids /*访客ids*/
|
||||||
|
,creator_name /*创建人名称*/
|
||||||
|
,modifier_name /*更新人名称*/
|
||||||
|
,ib_bridged_number /*呼入接通次数*/
|
||||||
|
,ob_bridged_number /*呼出接通次数*/
|
||||||
|
,ob_number /*呼出次数*/
|
||||||
|
,assign_time /*分配时间*/
|
||||||
|
,external_id /*外部企业客户ID (第三方平台 ID)*/
|
||||||
|
,ib_number /*呼入次数*/
|
||||||
|
,retrieve /*是否为回收客户*/
|
||||||
|
,retrieve_time /*回收时间*/
|
||||||
|
,queue_without_attribution /*无归属授权员工组*/
|
||||||
|
,phase_id /*客户阶段id*/
|
||||||
|
,phase_reason_id /*阶段原因id*/
|
||||||
|
,promote_source /*推广来源*/
|
||||||
|
,repeat_promote_count /*重复推广次数*/
|
||||||
|
,last_repeat_promote_time /*最近一次重复推广时间*/
|
||||||
|
,label_ids /*客户标签id*/
|
||||||
|
,id /*客户资料id*/
|
||||||
|
,Etl_Batch_No /*作业批次号*/
|
||||||
|
,Etl_First_Dt /*最初入库时间*/
|
||||||
|
,Etl_Job /*作业名称*/
|
||||||
|
,Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,Src_Sysname /*来源系统*/
|
||||||
|
,Src_Table /*来源表*/
|
||||||
|
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
P1.name /*客户名称*/
|
||||||
|
,P1.sex /*客户性别*/
|
||||||
|
,P1.tel /*客户号码*/
|
||||||
|
,P1.email /*邮箱*/
|
||||||
|
,P1.address /*地址*/
|
||||||
|
,P1.level /*客户等级*/
|
||||||
|
,P1.share_type /*归属类型,0:全体共享、1:员工组共享、2:员工私有、3:无归属*/
|
||||||
|
,P1.share /*客户归属*/
|
||||||
|
,P1.remark /*备注*/
|
||||||
|
,P1.source /*客户来源*/
|
||||||
|
,P1.creator_type /*创建人类型*/
|
||||||
|
,P1.creator_id /*创建人id,-1:openApi*/
|
||||||
|
,P1.modifier_type /*更新人类型*/
|
||||||
|
,P1.modifier_id /*更新人id,-1:openApi*/
|
||||||
|
,P1.last_contact_time /*最后一次联系时间*/
|
||||||
|
,P1.last_contact_type /*最后一次联系类型*/
|
||||||
|
,P1.customize /*该对象中,id为自定义字段id, name为自定义字段名称, value为自定义字段值*/
|
||||||
|
,P1.create_time /*创建时间*/
|
||||||
|
,P1.update_time /*更新时间*/
|
||||||
|
,P1.visitor_ids /*访客ids*/
|
||||||
|
,P1.creator_name /*创建人名称*/
|
||||||
|
,P1.modifier_name /*更新人名称*/
|
||||||
|
,P1.ib_bridged_number /*呼入接通次数*/
|
||||||
|
,P1.ob_bridged_number /*呼出接通次数*/
|
||||||
|
,P1.ob_number /*呼出次数*/
|
||||||
|
,P1.assign_time /*分配时间*/
|
||||||
|
,P1.external_id /*外部企业客户ID (第三方平台 ID)*/
|
||||||
|
,P1.ib_number /*呼入次数*/
|
||||||
|
,P1.retrieve /*是否为回收客户*/
|
||||||
|
,P1.retrieve_time /*回收时间*/
|
||||||
|
,P1.queue_without_attribution /*无归属授权员工组*/
|
||||||
|
,P1.phase_id /*客户阶段id*/
|
||||||
|
,P1.phase_reason_id /*阶段原因id*/
|
||||||
|
,P1.promote_source /*推广来源*/
|
||||||
|
,P1.repeat_promote_count /*重复推广次数*/
|
||||||
|
,P1.last_repeat_promote_time /*最近一次重复推广时间*/
|
||||||
|
,P1.label_ids /*客户标签id*/
|
||||||
|
,P1.id /*客户资料id*/
|
||||||
|
,P1.Etl_Batch_No /*作业批次号*/
|
||||||
|
,P1.Etl_First_Dt /*最初入库时间*/
|
||||||
|
,P1.Etl_Job /*作业名称*/
|
||||||
|
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,P1.Src_Sysname /*来源系统*/
|
||||||
|
,P1.Src_Table /*来源表*/
|
||||||
|
|
||||||
|
FROM t01_ccc_cust_info_agi_INS P1
|
||||||
|
ON CONFLICT ( id)
|
||||||
|
DO UPDATE SET
|
||||||
|
id=excluded.id
|
||||||
|
,name=excluded.name
|
||||||
|
,sex=excluded.sex
|
||||||
|
,tel=excluded.tel
|
||||||
|
,email=excluded.email
|
||||||
|
,address=excluded.address
|
||||||
|
,level=excluded.level
|
||||||
|
,share_type=excluded.share_type
|
||||||
|
,share=excluded.share
|
||||||
|
,remark=excluded.remark
|
||||||
|
,source=excluded.source
|
||||||
|
,creator_type=excluded.creator_type
|
||||||
|
,creator_id=excluded.creator_id
|
||||||
|
,modifier_type=excluded.modifier_type
|
||||||
|
,modifier_id=excluded.modifier_id
|
||||||
|
,last_contact_time=excluded.last_contact_time
|
||||||
|
,last_contact_type=excluded.last_contact_type
|
||||||
|
,customize=excluded.customize
|
||||||
|
,create_time=excluded.create_time
|
||||||
|
,update_time=excluded.update_time
|
||||||
|
,visitor_ids=excluded.visitor_ids
|
||||||
|
,creator_name=excluded.creator_name
|
||||||
|
,modifier_name=excluded.modifier_name
|
||||||
|
,ib_bridged_number=excluded.ib_bridged_number
|
||||||
|
,ob_bridged_number=excluded.ob_bridged_number
|
||||||
|
,ob_number=excluded.ob_number
|
||||||
|
,assign_time=excluded.assign_time
|
||||||
|
,external_id=excluded.external_id
|
||||||
|
,ib_number=excluded.ib_number
|
||||||
|
,retrieve=excluded.retrieve
|
||||||
|
,retrieve_time=excluded.retrieve_time
|
||||||
|
,queue_without_attribution=excluded.queue_without_attribution
|
||||||
|
,phase_id=excluded.phase_id
|
||||||
|
,phase_reason_id=excluded.phase_reason_id
|
||||||
|
,promote_source=excluded.promote_source
|
||||||
|
,repeat_promote_count=excluded.repeat_promote_count
|
||||||
|
,last_repeat_promote_time=excluded.last_repeat_promote_time
|
||||||
|
,label_ids=excluded.label_ids
|
||||||
|
,Etl_Batch_No=excluded.Etl_Batch_No
|
||||||
|
,Etl_First_Dt=excluded.Etl_First_Dt
|
||||||
|
,Etl_Job=excluded.Etl_Job
|
||||||
|
,Etl_Proc_Dt=excluded.Etl_Proc_Dt
|
||||||
|
,Etl_Tx_Dt=excluded.Etl_Tx_Dt
|
||||||
|
,Src_Sysname=excluded.Src_Sysname
|
||||||
|
,Src_Table=excluded.Src_Table
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
/*****程序结束退出 */
|
||||||
|
\q
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS p20_pdm.t01_ccc_cust_label;
|
||||||
|
CREATE TABLE IF NOT EXISTS p20_pdm.t01_ccc_cust_label (
|
||||||
|
label_id varchar(10)
|
||||||
|
, label_name varchar(50)
|
||||||
|
, label_group varchar(10)
|
||||||
|
, label_type varchar(10)
|
||||||
|
, label_color varchar(10)
|
||||||
|
, label_source varchar(10)
|
||||||
|
, Src_Sysname varchar(50)
|
||||||
|
, Src_Table varchar(50)
|
||||||
|
, Etl_Job varchar(200)
|
||||||
|
, Etl_First_Dt timestamp(0)
|
||||||
|
, Etl_Tx_Dt timestamp(0)
|
||||||
|
, Etl_Proc_Dt timestamp(0)
|
||||||
|
, Etl_Batch_No varchar(50)
|
||||||
|
,primary key( label_id )
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_id IS '标签编号';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_name IS '标签名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_group IS '标签组';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_type IS '标签类型';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_color IS '标签颜色';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.label_source IS '标签来源';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Src_Sysname IS '来源系统';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Src_Table IS '来源表';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Etl_Job IS '作业名称';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Etl_First_Dt IS '最初入库时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Etl_Tx_Dt IS '作业运行时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Etl_Proc_Dt IS '本次入库时间';
|
||||||
|
COMMENT ON COLUMN p20_pdm.t01_ccc_cust_label.Etl_Batch_No IS '作业批次号';
|
||||||
|
|
||||||
|
COMMENT ON TABLE p20_pdm.t01_ccc_cust_label IS 'smartccc客户标签维度';
|
|
@ -0,0 +1,117 @@
|
||||||
|
/***************************************************************************************************/
|
||||||
|
/*script in Sql, generate by SdmCreateScript 2020(by Qihang Feng, QF255001@TERADATA.COM) */
|
||||||
|
/*VERSION 01.10 revised on 2020-08-25 */
|
||||||
|
/*Brilliance stems from wisdoms. */
|
||||||
|
/*************Head Section**************************************************************************/
|
||||||
|
/*Script Use: Periodically load data to :t01_ccc_cust_label(smartccc客户标签维度) */
|
||||||
|
/*Create Date:2024-07-11 16:01:48 */
|
||||||
|
/*SDM Developed By: dev */
|
||||||
|
/*SDM Developed Date: 2024-07-11 */
|
||||||
|
/*SDM Checked By: dev */
|
||||||
|
/*SDM Checked Date: 2024-07-11 */
|
||||||
|
/*Script Developed By: dev */
|
||||||
|
/*Script Checked By: dev */
|
||||||
|
/*Source table 1: p10_sa.s98_s_tr_custom_labels */
|
||||||
|
/*Job Type: Inbound transform (Tier 1 to Tier 2) */
|
||||||
|
/*Target Table:t01_ccc_cust_label */
|
||||||
|
/*ETL Job Name:t01_ccc_cust_label */
|
||||||
|
/*ETL Frequency:Daily */
|
||||||
|
/*ETL Policy:F1 */
|
||||||
|
/********************************************************************************************/
|
||||||
|
/*******Main Section**************************************************************************/
|
||||||
|
\set ON_ERROR_STOP on
|
||||||
|
\set AUTOCOMMIT on
|
||||||
|
\timing on
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*创建临时表加载当前数据 */
|
||||||
|
CREATE TEMPORARY TABLE t01_ccc_cust_label_agi_CUR_I
|
||||||
|
( LIKE :PDMDB.t01_ccc_cust_label)
|
||||||
|
ON COMMIT PRESERVE ROWS;
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************************************/
|
||||||
|
/* GROUP 1:Source Table:s98_s_tr_custom_labels********************************************************/
|
||||||
|
/*****************************************************************************************************/
|
||||||
|
|
||||||
|
INSERT INTO t01_ccc_cust_label_agi_CUR_I (
|
||||||
|
label_id /*标签编号*/
|
||||||
|
,label_name /*标签名称*/
|
||||||
|
,label_group /*标签组*/
|
||||||
|
,label_type /*标签类型*/
|
||||||
|
,label_color /*标签颜色*/
|
||||||
|
,label_source /*标签来源*/
|
||||||
|
,Src_Sysname /*来源系统*/
|
||||||
|
,Src_Table /*来源表*/
|
||||||
|
,Etl_Job /*作业名称*/
|
||||||
|
,Etl_First_Dt /*最初入库时间*/
|
||||||
|
,Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,Etl_Batch_No /*作业批次号*/
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
jsonb_array_elements(customer_label_list::jsonb)->'id' /*label_id*/
|
||||||
|
,replace((jsonb_array_elements(customer_label_list::jsonb)->'name')::text,'"','') /*label_name*/
|
||||||
|
,jsonb_array_elements(customer_label_list::jsonb)->'groupId' /*label_group*/
|
||||||
|
,jsonb_array_elements(customer_label_list::jsonb)->'type' /*label_type*/
|
||||||
|
,replace((jsonb_array_elements(customer_label_list::jsonb)->'color')::text,'"','') /*label_color*/
|
||||||
|
,jsonb_array_elements(customer_label_list::jsonb)->'source' /*label_source*/
|
||||||
|
,Substr('s98_s_tr_custom_labels',1,3) /*Src_Sysname*/
|
||||||
|
,'s98_s_tr_custom_labels' /*Src_Table*/
|
||||||
|
,:ETLJOB /*Etl_Job*/
|
||||||
|
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/
|
||||||
|
,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_Tx_Dt*/
|
||||||
|
,current_timestamp(0) /*Etl_Proc_Dt*/
|
||||||
|
,0 /*Etl_Batch_No*/
|
||||||
|
|
||||||
|
FROM p10_sa.s98_s_tr_custom_labels p0
|
||||||
|
where label_group_name ='SCRM标签'
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*从目标表中删除所有数据 t01_ccc_cust_label(smartccc客户标签维度) */
|
||||||
|
DELETE FROM :PDMDB.t01_ccc_cust_label
|
||||||
|
WHERE ETL_JOB=:ETLJOB;
|
||||||
|
|
||||||
|
|
||||||
|
/*将新增数据插入到目标表 */
|
||||||
|
;INSERT INTO :PDMDB.t01_ccc_cust_label (
|
||||||
|
label_name /*标签名称*/
|
||||||
|
,label_group /*标签组*/
|
||||||
|
,label_type /*标签类型*/
|
||||||
|
,label_color /*标签颜色*/
|
||||||
|
,label_source /*标签来源*/
|
||||||
|
,label_id /*标签编号*/
|
||||||
|
,Src_Sysname /*来源系统*/
|
||||||
|
,Src_Table /*来源表*/
|
||||||
|
,Etl_Job /*作业名称*/
|
||||||
|
,Etl_First_Dt /*最初入库时间*/
|
||||||
|
,Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,Etl_Batch_No /*作业批次号*/
|
||||||
|
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
P1.label_name /*标签名称*/
|
||||||
|
,P1.label_group /*标签组*/
|
||||||
|
,P1.label_type /*标签类型*/
|
||||||
|
,P1.label_color /*标签颜色*/
|
||||||
|
,P1.label_source /*标签来源*/
|
||||||
|
,P1.label_id /*标签编号*/
|
||||||
|
,P1.Src_Sysname /*来源系统*/
|
||||||
|
,P1.Src_Table /*来源表*/
|
||||||
|
,P1.Etl_Job /*作业名称*/
|
||||||
|
,P1.Etl_First_Dt /*最初入库时间*/
|
||||||
|
,P1.Etl_Tx_Dt /*作业运行时间*/
|
||||||
|
,P1.Etl_Proc_Dt /*本次入库时间*/
|
||||||
|
,P1.Etl_Batch_No /*作业批次号*/
|
||||||
|
|
||||||
|
FROM t01_ccc_cust_label_agi_CUR_I P1
|
||||||
|
|
||||||
|
;
|
||||||
|
/*****程序结束退出 */
|
||||||
|
\q
|
||||||
|
|
|
@ -37,7 +37,7 @@ task_failed = EmailOperator (
|
||||||
cc=[""],
|
cc=[""],
|
||||||
subject="smart_ccc_custom_failed",
|
subject="smart_ccc_custom_failed",
|
||||||
html_content='<h3>您好,smart_ccc_custom作业失败,请及时处理" </h3>')
|
html_content='<h3>您好,smart_ccc_custom作业失败,请及时处理" </h3>')
|
||||||
|
|
||||||
customer_list_feign = SSHOperator(
|
customer_list_feign = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
task_id='customer_list_feign',
|
task_id='customer_list_feign',
|
||||||
|
@ -46,7 +46,17 @@ depends_on_past=False,
|
||||||
retries=3,
|
retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
|
customer_list_load = SSHOperator(
|
||||||
|
ssh_hook=sshHook,
|
||||||
|
task_id='customer_list_load',
|
||||||
|
command='/data/airflow/etl/API/run_psql.sh {{ ds_nodash }} {{params.my_param }}',
|
||||||
|
params={'my_param':"customer_list_load"},
|
||||||
|
depends_on_past=False,
|
||||||
|
retries=3,
|
||||||
|
dag=dag)
|
||||||
|
|
||||||
|
customer_list_feign >> customer_list_load
|
||||||
|
|
||||||
customer_labels_feign = SSHOperator(
|
customer_labels_feign = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
task_id='customer_labels_feign',
|
task_id='customer_labels_feign',
|
||||||
|
@ -65,7 +75,7 @@ retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
customer_labels_feign >> customer_labels_load
|
customer_labels_feign >> customer_labels_load
|
||||||
|
|
||||||
tr_custom_details_5516 = SSHOperator(
|
tr_custom_details_5516 = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
task_id='tr_custom_details_5516',
|
task_id='tr_custom_details_5516',
|
||||||
|
@ -74,7 +84,7 @@ params={'my_param':"S98_S_tr_custom_details"},
|
||||||
depends_on_past=False,
|
depends_on_past=False,
|
||||||
retries=3,
|
retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
tr_custom_labels_8280 = SSHOperator(
|
tr_custom_labels_8280 = SSHOperator(
|
||||||
ssh_hook=sshHook,
|
ssh_hook=sshHook,
|
||||||
task_id='tr_custom_labels_8280',
|
task_id='tr_custom_labels_8280',
|
||||||
|
@ -83,9 +93,45 @@ params={'my_param':"S98_S_tr_custom_labels"},
|
||||||
depends_on_past=False,
|
depends_on_past=False,
|
||||||
retries=3,
|
retries=3,
|
||||||
dag=dag)
|
dag=dag)
|
||||||
|
|
||||||
|
customer_detail_feign = SSHOperator(
|
||||||
|
ssh_hook=sshHook,
|
||||||
|
task_id='customer_detail_feign',
|
||||||
|
command='python3 /data/airflow/etl/API/customer_detail_feign.py',
|
||||||
|
depends_on_past=False,
|
||||||
|
retries=3,
|
||||||
|
dag=dag)
|
||||||
|
|
||||||
|
customer_detail_load = SSHOperator(
|
||||||
|
ssh_hook=sshHook,
|
||||||
|
task_id='customer_detail_load',
|
||||||
|
command='/data/airflow/etl/API/run_psql.sh {{ ds_nodash }} {{params.my_param }}',
|
||||||
|
params={'my_param':"customer_detail_load"},
|
||||||
|
depends_on_past=False,
|
||||||
|
retries=3,
|
||||||
|
dag=dag)
|
||||||
|
|
||||||
customer_labels_load >> tr_custom_labels_8280
|
customer_detail_feign >> customer_detail_load
|
||||||
customer_list_feign >> tr_custom_details_5516
|
|
||||||
tr_custom_details_5516 >> task_failed
|
t01_ccc_cust_label = SSHOperator(
|
||||||
tr_custom_details_5516 >> task_failed
|
ssh_hook=sshHook,
|
||||||
|
task_id='t01_ccc_cust_label',
|
||||||
|
command='/data/airflow/etl/PDM/run_psql.sh {{ ds_nodash }} {{params.my_param}} >>/data/airflow/logs/run_tpt_{{ds_nodash}}.log 2>&1 ',
|
||||||
|
params={'my_param':"t01_ccc_cust_label_agi"},
|
||||||
|
depends_on_past=False,
|
||||||
|
retries=3,
|
||||||
|
dag=dag)
|
||||||
|
t01_ccc_cust_info = SSHOperator(
|
||||||
|
ssh_hook=sshHook,
|
||||||
|
task_id='t01_ccc_cust_info',
|
||||||
|
command='/data/airflow/etl/PDM/run_psql.sh {{ ds_nodash }} {{params.my_param}} >>/data/airflow/logs/run_tpt_{{ds_nodash}}.log 2>&1 ',
|
||||||
|
params={'my_param':"t01_ccc_cust_info_agi"},
|
||||||
|
depends_on_past=False,
|
||||||
|
retries=3,
|
||||||
|
dag=dag)
|
||||||
|
customer_labels_load >> tr_custom_labels_8280
|
||||||
|
customer_list_load >> tr_custom_details_5516
|
||||||
|
tr_custom_labels_8280 >> t01_ccc_cust_label
|
||||||
|
tr_custom_details_5516 >> t01_ccc_cust_info
|
||||||
|
t01_ccc_cust_info >> task_failed
|
||||||
|
customer_detail_load >> task_failed
|
||||||
|
|
Loading…
Reference in New Issue