dicemy's picture
Upload 655 files
e8c001c verified
Raw
History Blame Contribute Delete
11.3 kB
CREATE DATABASE IF NOT EXISTS internal_platform_db;
-- Input table 1: dim_ds_org_info_d_ql
CREATE TABLE IF NOT EXISTS internal_platform_db.dim_ds_org_info_d_ql_query_engine_143 (
`imp_date` BIGINT COMMENT '时间分区',
`org_id` STRING,
`org_name` STRING,
`is_test_org` BIGINT,
`ds_org_id` STRING,
`ds_org_name` STRING,
`org_type` BIGINT,
`create_time` STRING,
`update_time` STRING
) STORED AS ORC;
INSERT INTO TABLE internal_platform_db.dim_ds_org_info_d_ql_query_engine_143 VALUES
(20260608, 'org001', 'OrgA', 0, 'ds_org_001', 'DsOrgA', 1, '2025-01-10 10:00:00', '2025-01-10 10:00:00'),
(20260608, 'org002', 'OrgB', 0, 'ds_org_002', 'DsOrgB', 2, '2025-03-15 08:00:00', '2025-03-15 08:00:00'),
(20260608, 'org003', 'OrgC', 0, 'ds_org_003', 'DsOrgC', 1, '2025-06-01 09:00:00', '2025-06-01 09:00:00'),
(20260608, 'org004', 'OrgD', 1, 'ds_org_004', 'DsOrgD', 3, '2025-07-01 09:00:00', '2025-07-01 09:00:00');
-- Input table 2: dim_ds_project_info_d_ql
CREATE TABLE IF NOT EXISTS internal_platform_db.dim_ds_project_info_d_ql_query_engine_143 (
`imp_date` BIGINT,
`project_id` STRING,
`project_name` STRING,
`is_test_project` BIGINT,
`initiate_org_id` STRING,
`initiate_org_name` STRING,
`funder_org_id` STRING,
`funder_org_name` STRING,
`ds_project_id` STRING,
`ds_project_name` STRING,
`ds_org_id` STRING,
`ds_org_name` STRING,
`people_cnt` BIGINT,
`auth_people_cnt` BIGINT,
`is_1v1_donate_project` BIGINT,
`is_fundraising_money` BIGINT,
`raised_money_amount` BIGINT,
`fundraising_platform` BIGINT,
`create_time` STRING,
`update_time` STRING,
`explicit_card` BIGINT,
`push_progress` BIGINT,
`card_o2o` BIGINT
) STORED AS ORC;
INSERT INTO TABLE internal_platform_db.dim_ds_project_info_d_ql_query_engine_143 VALUES
(20260608, 'p001', 'Project1', 0, 'org001', 'OrgA', 'org001', 'OrgA', 'ds_pid_001', 'DsPid1', 'ds_org_001', 'DsOrgA', 100, 50, 0, 1, 100000, 2, '2025-02-01 10:00:00', '2025-02-01 10:00:00', 0, 0, 0),
(20260608, 'p002', 'Project2', 0, 'org002', 'OrgB', 'org002', 'OrgB', 'ds_pid_002', 'DsPid2', 'ds_org_002', 'DsOrgB', 200, 80, 1, 1, 200000, 2, '2025-03-20 10:00:00', '2025-03-20 10:00:00', 0, 0, 0),
(20260608, 'p003', 'Project3', 0, 'org003', 'OrgC', 'org003', 'OrgC', 'ds_pid_003', 'DsPid3', 'ds_org_003', 'DsOrgC', 50, 20, 0, 0, 0, 1, '2025-06-05 10:00:00', '2025-06-05 10:00:00', 0, 0, 0),
(20260608, 'p004', 'Project4', 1, 'org001', 'OrgA', 'org001', 'OrgA', 'ds_pid_004', 'DsPid4', 'ds_org_001', 'DsOrgA', 10, 5, 0, 0, 0, 2, '2025-04-01 10:00:00', '2025-04-01 10:00:00', 0, 0, 0);
-- Input table 3: dim_ds_grantee_data_d_ql
CREATE TABLE IF NOT EXISTS internal_platform_db.dim_ds_grantee_data_d_ql_query_engine_143 (
`imp_date` BIGINT,
`ds_grantee_id` STRING,
`ds_grantee_nation` STRING,
`ds_grantee_gender` BIGINT,
`ds_grantee_birthday` STRING,
`province_code` STRING,
`province` STRING,
`city_code` STRING,
`city` STRING,
`county_code` STRING,
`county` STRING,
`address` STRING,
`ds_agent_id` STRING,
`ds_grantee_state` STRING,
`open_id` STRING,
`platformw_auth_time` STRING,
`agent_open_id` STRING,
`agent_platformw_auth_time` STRING,
`project_id` STRING,
`project_name` STRING,
`is_test_project` BIGINT,
`initiate_org_id` STRING,
`initiate_org_name` STRING,
`funder_org_id` STRING,
`funder_org_name` STRING,
`ds_project_id` STRING,
`ds_project_name` STRING,
`ds_org_id` STRING,
`ds_org_name` STRING,
`create_time` STRING,
`update_time` STRING,
`bank_account` STRING
) STORED AS ORC;
INSERT INTO TABLE internal_platform_db.dim_ds_grantee_data_d_ql_query_engine_143 VALUES
(20260608, 'grantee_001', 'Han', 2, '1990-01-01', '110000', 'Beijing', '110100', 'Beijing', '110101', 'Dongcheng', 'Addr1', 'agent_001', '0', 'openid_001', '2025-02-15 10:00:00', '', '', 'p001', 'Project1', 0, 'org001', 'OrgA', 'org001', 'OrgA', 'ds_pid_001', 'DsPid1', 'ds_org_001', 'DsOrgA', '2025-02-10 10:00:00', '2025-02-10 10:00:00', 'bank_acc_001'),
(20260608, 'grantee_002', 'Han', 1, '1995-05-05', '310000', 'Shanghai', '310100', 'Shanghai', '310101', 'Huangpu', 'Addr2', 'agent_001', '0', 'openid_002', '2025-03-25 10:00:00', 'agent_openid_002', '2025-03-20 10:00:00', 'p002', 'Project2', 0, 'org002', 'OrgB', 'org002', 'OrgB', 'ds_pid_002', 'DsPid2', 'ds_org_002', 'DsOrgB', '2025-03-22 10:00:00', '2025-03-22 10:00:00', ''),
(20260608, 'grantee_003', 'Zhuang', 1, '2000-08-08', '440000', 'Guangdong', '440100', 'Guangzhou', '440106', 'Tianhe', 'Addr3', 'agent_002', '1', '', '', '', '', 'p001', 'Project1', 0, 'org001', 'OrgA', 'org001', 'OrgA', 'ds_pid_001', 'DsPid1', 'ds_org_001', 'DsOrgA', '2025-04-01 10:00:00', '2025-04-01 10:00:00', 'bank_acc_003'),
(20260608, 'grantee_004', 'Han', 2, '1988-12-12', '510000', 'Sichuan', '510100', 'Chengdu', '510104', 'Jinjiang', 'Addr4', 'agent_003', '0', '', '', 'agent_openid_004', '2025-06-10 10:00:00', 'p003', 'Project3', 0, 'org003', 'OrgC', 'org003', 'OrgC', 'ds_pid_003', 'DsPid3', 'ds_org_003', 'DsOrgC', '2025-06-08 10:00:00', '2025-06-08 10:00:00', ''),
(20260608, 'grantee_005', 'Han', 2, '1992-03-03', '110000', 'Beijing', '110100', 'Beijing', '110102', 'Xicheng', 'Addr5', 'agent_001', '2', 'openid_005', '2025-01-05 10:00:00', '', '', 'p002', 'Project2', 0, 'org002', 'OrgB', 'org002', 'OrgB', 'ds_pid_002', 'DsPid2', 'ds_org_002', 'DsOrgB', '2025-01-03 10:00:00', '2025-01-03 10:00:00', 'bank_acc_005');
-- Input table 4: dwd_project_ds_transfer_log_d_ql
CREATE TABLE IF NOT EXISTS internal_platform_db.dwd_project_ds_transfer_log_d_ql_query_engine_143 (
`imp_date` BIGINT,
`id` STRING,
`project_id` STRING,
`project_name` STRING,
`initiate_org_id` STRING,
`initiate_org_name` STRING,
`project_card_id` STRING,
`ds_org_id` STRING,
`ds_project_id` STRING,
`ds_grantee_id` STRING,
`transfer_amount` BIGINT,
`transfer_mode` BIGINT,
`transfer_state` BIGINT,
`trans_succ_time` STRING,
`create_time` STRING,
`update_time` STRING,
`fund_batch_no` BIGINT
) STORED AS ORC;
INSERT INTO TABLE internal_platform_db.dwd_project_ds_transfer_log_d_ql_query_engine_143 VALUES
(20260608, 'tx001', 'p001', 'Project1', 'org001', 'OrgA', 'card001', 'ds_org_001', 'ds_pid_001', 'grantee_001', 5000, 1, 2, '2025-02-20 14:00:00', '2025-02-20 13:00:00', '2025-02-20 14:00:00', 1),
(20260608, 'tx002', 'p002', 'Project2', 'org002', 'OrgB', 'card002', 'ds_org_002', 'ds_pid_002', 'grantee_002', 8000, 2, 2, '2025-04-01 10:00:00', '2025-03-30 09:00:00', '2025-04-01 10:00:00', 2),
(20260608, 'tx003', 'p001', 'Project1', 'org001', 'OrgA', 'card003', 'ds_org_001', 'ds_pid_001', 'grantee_003', 3000, 1, 2, '2025-05-10 11:00:00', '2025-05-10 10:00:00', '2025-05-10 11:00:00', 3),
(20260608, 'tx004', 'p003', 'Project3', 'org003', 'OrgC', 'card004', 'ds_org_003', 'ds_pid_003', 'grantee_004', 10000, 2, 2, '', '2025-06-15 08:00:00', '2025-06-15 09:00:00', 4),
(20260608, 'tx005', 'p002', 'Project2', 'org002', 'OrgB', 'card005', 'ds_org_002', 'ds_pid_002', 'grantee_002', 2000, 1, 3, '2025-07-01 10:00:00', '2025-07-01 09:00:00', '2025-07-01 10:00:00', 5);
-- Target table: ads_gy_digital_tool_used_plat_data_d_ql
CREATE TABLE IF NOT EXISTS internal_platform_db.ads_gy_digital_tool_used_plat_data_d_ql_query_engine_143 (
`imp_date` BIGINT,
`fundraising_platform` STRING,
`stat_date` STRING,
`total_org_cnt` BIGINT,
`total_pid_org_cnt` BIGINT,
`total_pid_cnt` BIGINT,
`total_user_org_cnt` BIGINT,
`total_user_pid_cnt` BIGINT,
`total_user_cnt` BIGINT,
`total_agent_cnt` BIGINT,
`total_platformw_auth_user_cnt` BIGINT,
`total_bank_auth_user_cnt` BIGINT,
`total_transfer_amount` BIGINT,
`total_platformw_transfer_amount` BIGINT,
`total_bank_transfer_amount` BIGINT,
`total_transfer_cnt` BIGINT,
`total_platformw_transfer_cnt` BIGINT,
`total_bank_transfer_cnt` BIGINT,
`total_transfer_org_cnt` BIGINT,
`total_platformw_transfer_org_cnt` BIGINT,
`total_bank_transfer_org_cnt` BIGINT,
`total_transfer_pid_cnt` BIGINT,
`total_platformw_transfer_pid_cnt` BIGINT,
`total_bank_transfer_pid_cnt` BIGINT,
`total_transfer_user_cnt` BIGINT,
`total_platformw_transfer_user_cnt` BIGINT,
`total_bank_transfer_user_cnt` BIGINT,
`new_org_cnt` BIGINT,
`new_pid_org_cnt` BIGINT,
`new_pid_cnt` BIGINT,
`new_user_org_cnt` BIGINT,
`new_user_pid_cnt` BIGINT,
`new_user_cnt` BIGINT,
`new_agent_cnt` BIGINT,
`new_platformw_auth_user_cnt` BIGINT,
`new_bank_auth_user_cnt` BIGINT,
`new_transfer_amount` BIGINT,
`new_platformw_transfer_amount` BIGINT,
`new_bank_transfer_amount` BIGINT,
`new_transfer_cnt` BIGINT,
`new_platformw_transfer_cnt` BIGINT,
`new_bank_transfer_cnt` BIGINT,
`new_transfer_org_cnt` BIGINT,
`new_platformw_transfer_org_cnt` BIGINT,
`new_bank_transfer_org_cnt` BIGINT,
`new_transfer_pid_cnt` BIGINT,
`new_platformw_transfer_pid_cnt` BIGINT,
`new_bank_transfer_pid_cnt` BIGINT,
`new_transfer_user_cnt` BIGINT,
`new_platformw_transfer_user_cnt` BIGINT,
`new_bank_transfer_user_cnt` BIGINT
) STORED AS ORC;
-- Agent 候选目标表
CREATE TABLE IF NOT EXISTS internal_platform_db.ads_gy_digital_tool_used_plat_data_d_ql_cand_query_engine_143 (
`imp_date` BIGINT,
`fundraising_platform` STRING,
`stat_date` STRING,
`total_org_cnt` BIGINT,
`total_pid_org_cnt` BIGINT,
`total_pid_cnt` BIGINT,
`total_user_org_cnt` BIGINT,
`total_user_pid_cnt` BIGINT,
`total_user_cnt` BIGINT,
`total_agent_cnt` BIGINT,
`total_platformw_auth_user_cnt` BIGINT,
`total_bank_auth_user_cnt` BIGINT,
`total_transfer_amount` BIGINT,
`total_platformw_transfer_amount` BIGINT,
`total_bank_transfer_amount` BIGINT,
`total_transfer_cnt` BIGINT,
`total_platformw_transfer_cnt` BIGINT,
`total_bank_transfer_cnt` BIGINT,
`total_transfer_org_cnt` BIGINT,
`total_platformw_transfer_org_cnt` BIGINT,
`total_bank_transfer_org_cnt` BIGINT,
`total_transfer_pid_cnt` BIGINT,
`total_platformw_transfer_pid_cnt` BIGINT,
`total_bank_transfer_pid_cnt` BIGINT,
`total_transfer_user_cnt` BIGINT,
`total_platformw_transfer_user_cnt` BIGINT,
`total_bank_transfer_user_cnt` BIGINT,
`new_org_cnt` BIGINT,
`new_pid_org_cnt` BIGINT,
`new_pid_cnt` BIGINT,
`new_user_org_cnt` BIGINT,
`new_user_pid_cnt` BIGINT,
`new_user_cnt` BIGINT,
`new_agent_cnt` BIGINT,
`new_platformw_auth_user_cnt` BIGINT,
`new_bank_auth_user_cnt` BIGINT,
`new_transfer_amount` BIGINT,
`new_platformw_transfer_amount` BIGINT,
`new_bank_transfer_amount` BIGINT,
`new_transfer_cnt` BIGINT,
`new_platformw_transfer_cnt` BIGINT,
`new_bank_transfer_cnt` BIGINT,
`new_transfer_org_cnt` BIGINT,
`new_platformw_transfer_org_cnt` BIGINT,
`new_bank_transfer_org_cnt` BIGINT,
`new_transfer_pid_cnt` BIGINT,
`new_platformw_transfer_pid_cnt` BIGINT,
`new_bank_transfer_pid_cnt` BIGINT,
`new_transfer_user_cnt` BIGINT,
`new_platformw_transfer_user_cnt` BIGINT,
`new_bank_transfer_user_cnt` BIGINT
) STORED AS ORC;