|
@@ -11,7 +11,7 @@ du=DateUtils()
|
|
|
|
|
|
def run(dt):
|
|
|
sql=f"""SELECT a.dt,b.type,sum(a.cost),sum(view_count),sum(click_count),sum(follow_count),sum(order_count),sum(order_amount),
|
|
|
- title,description,e.channel,pitcher,book,platform,stage,ifnull(image_id,'')
|
|
|
+ title,description,book,platform,stage,ifnull(image_id,'')
|
|
|
from
|
|
|
ad_cost_day a
|
|
|
left join ad_info b on a.ad_id=b.ad_id
|
|
@@ -19,7 +19,7 @@ def run(dt):
|
|
|
left join channel_by_account_daily e on b.account_id=e.account_id and a.dt=e.dt
|
|
|
left join channel_info_daily f on e.channel=f.channel and e.dt=f.dt
|
|
|
where a.dt='{dt}'
|
|
|
- group by a.dt,b.type,title,description,e.channel,pitcher,book,platform,stage,image_id
|
|
|
+ group by a.dt,b.type,title,description,book,platform,stage,image_id
|
|
|
|
|
|
"""
|
|
|
|
|
@@ -54,7 +54,8 @@ def run(dt):
|
|
|
|
|
|
# print(data)
|
|
|
|
|
|
- db.dm.executeMany("replace into dw_image_cost_day values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",data)
|
|
|
+ db.dm.execute(f'delete from dw_image_cost_day where dt="{dt}"')
|
|
|
+ db.dm.executeMany("replace into dw_image_cost_day values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",data)
|
|
|
|
|
|
|
|
|
|
|
@@ -67,5 +68,5 @@ def day():
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- # day()
|
|
|
- run('2021-04-07')
|
|
|
+ day()
|
|
|
+ # run('2021-04-08')
|