From c515868cc45ee0d76dfd16abcc7ad6b892e7b591 Mon Sep 17 00:00:00 2001
From: root <root@64792e78fd4d>
Date: Fri, 23 Aug 2024 14:39:14 +0800
Subject: [PATCH] =?UTF-8?q?add=20workflow=20=E5=A4=A9=E6=B6=A6Smart-ccc?=
 =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=95=B0=E6=8D=AE,dev?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../smart_ccc_custom/客户标签关系表/cust_label_rela.sql  | 2 +-
 .../客户标签关系表/cust_label_rela_agi.sql               | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela.sql b/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela.sql
index 3052e75..ac7ce1e 100644
--- a/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela.sql
+++ b/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela.sql
@@ -3,7 +3,7 @@ DROP TABLE IF EXISTS p30_common.cust_label_rela;
 CREATE TABLE IF NOT EXISTS p30_common.cust_label_rela (
 	 cust_id  varchar(10) 
 	, cust_label_id  varchar(10) 
-	, cust_label_name  varchar(50) 
+	, cust_label_name  varchar(200) 
 	, cust_external_id  varchar(50) 
 	, Etl_Batch_No  varchar(50) 
 	, Etl_First_Dt  timestamp(0) 
diff --git a/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela_agi.sql b/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela_agi.sql
index 3a51ccd..2e74722 100644
--- a/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela_agi.sql
+++ b/dev/workflow/TK_Cust/smart_ccc_custom/客户标签关系表/cust_label_rela_agi.sql
@@ -4,11 +4,11 @@
 /*Brilliance stems from wisdoms.                                                                   */
 /*************Head Section**************************************************************************/
 /*Script Use: Periodically load data to :cust_label_rela(客户标签关系表)             */
-/*Create Date:2024-08-01 15:48:28                                                                  */
+/*Create Date:2024-08-23 14:38:21                                                                  */
 /*SDM Developed By: dev                                                                            */
 /*SDM Developed Date: 2024-07-11                                                                   */
 /*SDM Checked By: dev                                                                              */
-/*SDM Checked Date: 2024-08-01                                                                     */
+/*SDM Checked Date: 2024-08-23                                                                     */
 /*Script Developed By: dev                                                                         */
 /*Script Checked By: dev                                                                           */
 /*Source table 1: :PDMDB.t01_ccc_cust_info                                                         */
@@ -69,8 +69,9 @@ SELECT
         ,Substr('t01_ccc_cust_info',1,3)                           /*Src_Sysname*/
         ,'t01_ccc_cust_info'                                       /*Src_Table*/
         
-FROM (select id,trim(unnest(string_to_array(replace(replace(label_ids,'[',''),']',''),','))) label_id,external_id  from p20_pdm.t01_ccc_cust_info tcci
-where length(trim(external_id))>0) p0  
+FROM (select * from (select id,trim(unnest(string_to_array(replace(replace(label_ids,'[',''),']',''),','))) label_id, trim(unnest(string_to_array(replace(external_id,';',','),''))) external_id from p20_pdm.t01_ccc_cust_info tcci
+where length(trim(external_id))>0)p
+where label_id is not null and external_id is not null) p0  
 LEFT JOIN :PDMDB.t01_ccc_cust_label  p1
         ON p0.label_id=p1.label_id