|
@@ -21,7 +21,7 @@ class AppBytedanceAccountBaseInfoDsD:
|
|
def taskHandler(self):
|
|
def taskHandler(self):
|
|
try:
|
|
try:
|
|
sql = """
|
|
sql = """
|
|
- SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
|
|
|
|
+ SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
|
|
replace into `application`.`app_bytedance_account_base_info_d`
|
|
replace into `application`.`app_bytedance_account_base_info_d`
|
|
(
|
|
(
|
|
stat_date,
|
|
stat_date,
|
|
@@ -52,7 +52,8 @@ class AppBytedanceAccountBaseInfoDsD:
|
|
put_campaign_num,
|
|
put_campaign_num,
|
|
put_unit_num,
|
|
put_unit_num,
|
|
trust_campaign_num,
|
|
trust_campaign_num,
|
|
- trust_unit_num
|
|
|
|
|
|
+ trust_unit_num,
|
|
|
|
+ new_cpd_project_num
|
|
)
|
|
)
|
|
select {date_time} stat_date,
|
|
select {date_time} stat_date,
|
|
t1.account_id,
|
|
t1.account_id,
|
|
@@ -82,7 +83,8 @@ select {date_time} stat_date,
|
|
0 as put_campaign_num,
|
|
0 as put_campaign_num,
|
|
0 as put_unit_num,
|
|
0 as put_unit_num,
|
|
0 as trust_campaign_num,
|
|
0 as trust_campaign_num,
|
|
- 0 as trust_unit_num
|
|
|
|
|
|
+ 0 as trust_unit_num,
|
|
|
|
+ project_num as new_cpd_project_num
|
|
from (select * from `jeecg-boot`.ctop_user_allocation where media_id = 1) t1
|
|
from (select * from `jeecg-boot`.ctop_user_allocation where media_id = 1) t1
|
|
left join
|
|
left join
|
|
(select account_id, count(id) ad_num
|
|
(select account_id, count(id) ad_num
|
|
@@ -121,49 +123,55 @@ from (select * from `jeecg-boot`.ctop_user_allocation where media_id = 1) t1
|
|
group by advertiser_id) all_video
|
|
group by advertiser_id) all_video
|
|
on t1.account_id = all_video.account_id
|
|
on t1.account_id = all_video.account_id
|
|
left join
|
|
left join
|
|
- (select t2.account_id, count(distinct t1.material_id) new_eff_material
|
|
|
|
- from (select material_id from application.app_bytedance_material_info where effect_date = {date_time}) t1
|
|
|
|
|
|
+ (select t2.account_id, count(distinct t1.signature) new_eff_material
|
|
|
|
+ from (select signature from application.effect_material where effect_date = {date_time}) t1
|
|
inner join
|
|
inner join
|
|
(select distinct advertiser_id account_id, signature
|
|
(select distinct advertiser_id account_id, signature
|
|
from `media_api`.bytedance_file_video_get
|
|
from `media_api`.bytedance_file_video_get
|
|
where date_format(create_time, '%Y%m%d') >=
|
|
where date_format(create_time, '%Y%m%d') >=
|
|
date_sub({date_time}, INTERVAL 29 DAY)) t2
|
|
date_sub({date_time}, INTERVAL 29 DAY)) t2
|
|
- on t1.material_id = t2.signature
|
|
|
|
|
|
+ on t1.signature = t2.signature
|
|
group by t2.account_id) t4
|
|
group by t2.account_id) t4
|
|
on t1.account_id = t4.account_id
|
|
on t1.account_id = t4.account_id
|
|
|
|
|
|
left join
|
|
left join
|
|
- (select t2.account_id, count(distinct t1.material_id) new_eff_material
|
|
|
|
- from (select material_id from application.app_bytedance_material_info where effect_date <= {date_time}) t1
|
|
|
|
|
|
+ (select t2.account_id, count(distinct t1.signature) new_eff_material
|
|
|
|
+ from (select signature from application.effect_material where effect_date <= {date_time}) t1
|
|
inner join
|
|
inner join
|
|
(select distinct advertiser_id account_id, signature
|
|
(select distinct advertiser_id account_id, signature
|
|
from `media_api`.bytedance_file_video_get
|
|
from `media_api`.bytedance_file_video_get
|
|
where date_format(create_time, '%Y%m%d') <= {date_time}) t2
|
|
where date_format(create_time, '%Y%m%d') <= {date_time}) t2
|
|
- on t1.material_id = t2.signature
|
|
|
|
|
|
+ on t1.signature = t2.signature
|
|
group by t2.account_id) sum_eff
|
|
group by t2.account_id) sum_eff
|
|
on t1.account_id = sum_eff.account_id
|
|
on t1.account_id = sum_eff.account_id
|
|
|
|
+ left join(
|
|
|
|
+ select advertiser_id,count(distinct project_id) as project_num from media_api.bytedance_cdp_project
|
|
|
|
+ where date_format(project_create_time, '%Y%m%d') = {date_time}
|
|
|
|
+ group by advertiser_id
|
|
|
|
+ )pro
|
|
|
|
+ on t1.account_id=pro.advertiser_id
|
|
|
|
|
|
left join
|
|
left join
|
|
- (select t2.account_id, count(distinct t1.material_id) new_hot_material
|
|
|
|
- from (select material_id from application.app_bytedance_material_info where faddish_date = {date_time}) t1
|
|
|
|
|
|
+ (select t2.account_id, count(distinct t1.signature) new_hot_material
|
|
|
|
+ from (select signature from application.hot_material where hot_date = {date_time} and media_id=1) t1
|
|
inner join
|
|
inner join
|
|
(select distinct advertiser_id account_id, signature
|
|
(select distinct advertiser_id account_id, signature
|
|
from `media_api`.bytedance_file_video_get
|
|
from `media_api`.bytedance_file_video_get
|
|
where date_format(create_time, '%Y%m%d') >=
|
|
where date_format(create_time, '%Y%m%d') >=
|
|
date_sub({date_time}, INTERVAL 29 DAY)) t2
|
|
date_sub({date_time}, INTERVAL 29 DAY)) t2
|
|
- on t1.material_id = t2.signature
|
|
|
|
|
|
+ on t1.signature = t2.signature
|
|
group by t2.account_id) t5
|
|
group by t2.account_id) t5
|
|
on t1.account_id = t5.account_id
|
|
on t1.account_id = t5.account_id
|
|
|
|
|
|
|
|
|
|
left join
|
|
left join
|
|
- (select t2.account_id, count(distinct t1.material_id) new_hot_material
|
|
|
|
- from (select material_id from application.app_bytedance_material_info where faddish_date <= {date_time}) t1
|
|
|
|
|
|
+ (select t2.account_id, count(distinct t1.signature) new_hot_material
|
|
|
|
+ from (select signature from application.hot_material where hot_date<= {date_time}) t1
|
|
inner join
|
|
inner join
|
|
(select distinct advertiser_id account_id, signature
|
|
(select distinct advertiser_id account_id, signature
|
|
from `media_api`.bytedance_file_video_get
|
|
from `media_api`.bytedance_file_video_get
|
|
where date_format(create_time, '%Y%m%d') <= {date_time}) t2
|
|
where date_format(create_time, '%Y%m%d') <= {date_time}) t2
|
|
- on t1.material_id = t2.signature
|
|
|
|
|
|
+ on t1.signature = t2.signature
|
|
group by t2.account_id) sum_hot
|
|
group by t2.account_id) sum_hot
|
|
on t1.account_id = sum_hot.account_id
|
|
on t1.account_id = sum_hot.account_id
|
|
|
|
|