notebook/flinksql/sqlcopy/game_merge.sql
2025-04-01 11:41:15 +08:00

142 lines
3.0 KiB
SQL

--********************************************************************--
-- Author: zhougongping
-- Created Time: 2024-11-01 11:59:52
-- Description: 传2、3、4合服同步
--********************************************************************--
CREATE TEMPORARY TABLE cq_apply_hefu_servers
(
id int
,startsid int
,endsid VARCHAR
,isconfirm int
,merge_time int
,game_id int
,PRIMARY KEY(id) NOT ENFORCED
)
WITH (
'connector' = 'mysql',
'hostname' = 'rm-bp14do37zk3o0x7c1nm.mysql.rds.aliyuncs.com',
'port' = '3306',
'username' = 'dhsf_gm_mc',
'password' = '${secret_values.dhsf_gm_mc_pwd}',
'database-name' = 'dhsf_gm',
'table-name' = 'apply_hefu_servers',
'server-id' = '24071-24078',
'scan.startup.mode' = 'initial',
'server-time-zone' = 'Asia/Shanghai'
)
;
CREATE TEMPORARY TABLE cs_apply_hefu_servers
(
id int
,startsid int
,endsid VARCHAR
,isconfirm int
,merge_time int
,game_id int
,PRIMARY KEY(id) NOT ENFORCED
)
WITH (
'connector' = 'mysql',
'hostname' = 'rm-wz9h3jss8diq63g3x8o.mysql.rds.aliyuncs.com',
'port' = '3306',
'username' = 'csyq_mc',
'password' = '${secret_values.csyq_mc_pwd}',
'database-name' = 'csyq_gm',
'table-name' = 'apply_hefu_servers',
'server-id' = '24071-24078',
'scan.startup.mode' = 'initial',
'server-time-zone' = 'Asia/Shanghai'
)
;
CREATE TEMPORARY TABLE c3_apply_hefu_servers
(
id int
,startsid int
,endsid VARCHAR
,isconfirm int
,merge_time int
,game_id int
,PRIMARY KEY(id) NOT ENFORCED
)
WITH (
'connector' = 'mysql',
'hostname' = 'rm-bp1l808gp11p7czx4zo.mysql.rds.aliyuncs.com',
'port' = '3306',
'username' = 'dhsf_gm_mc',
'password' = '${secret_values.dhsf_gm_mc_pwd}',
'database-name' = 'c3yq_gm',
'table-name' = 'apply_hefu_servers',
'server-id' = '24071-24078',
'scan.startup.mode' = 'initial',
'server-time-zone' = 'Asia/Shanghai'
)
;
CREATE TEMPORARY TABLE game_merge
(
src VARCHAR
,id bigint
,game_id int
,start_id int
,end_ids VARCHAR
,isconfirm int
,merge_time int
,PRIMARY KEY(src, id) NOT ENFORCED
)
WITH (
'connector' = 'hologres',
'endpoint' = 'hgprecn-cn-n8m2xw5ez001-cn-hangzhou-vpc.hologres.aliyuncs.com:80',
'username' = '${secret_values.996engine_ak}',
'password' = '${secret_values.996engine_sk}',
'dbname' = 'dhsf_engine',
'tablename' = 'game_merge',
'property-version' = '1',
'mutatetype' = 'insertorupdate',
'ignoredelete' = 'false'
)
;
INSERT INTO
game_merge
SELECT
'cq' AS src
,id
,game_id
,startsid
,endsid
,isconfirm
,merge_time
FROM
cq_apply_hefu_servers
UNION ALL
SELECT
'cs' AS src
,id
,game_id
,startsid
,endsid
,isconfirm
,merge_time
FROM
cs_apply_hefu_servers
UNION ALL
SELECT
'c3' AS src
,id
,game_id
,startsid
,endsid
,isconfirm
,merge_time
FROM
c3_apply_hefu_servers
;