Files
MarketAnalysis-ETL/EXTERNAL/CHPA/03 dm_td_ims_city_mapping.sql
2026-04-20 14:55:25 +08:00

30 lines
827 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Databricks notebook source
-- 源表DWD.DWD_TD_IMS_CITY_MAPPING
-- 目标表DM.DM_TD_IMS_CITY_MAPPING,DWS.DWS_TD_GEOGRAPHY
-- COMMAND ----------
--dwd to dws
--ims city和标准城市名以及拆分比mapping表
insert overwrite table dws.dws_td_ims_city_mapping
select distinct
audit_cod ,
city_c ,
city_c_d ,
ratio ,
from_utc_timestamp(current_timestamp(),'UTC+8'),
from_utc_timestamp(current_timestamp(),'UTC+8')
from dwd.dwd_td_ims_city_mapping
;
--dws to dm
insert overwrite table dm.dm_td_ims_city_mapping
select distinct
audit_cod ,
city_c ,
city_c_d ,
city_code,
ratio ,
from_utc_timestamp(current_timestamp(),'UTC+8'),
from_utc_timestamp(current_timestamp(),'UTC+8')
from dws.dws_td_ims_city_mapping t1
left join dws.dws_td_geography t2 on concat(t1.city_c_d,'')=t2.city_name