-- 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