|  | @@ -120,16 +120,8 @@ def run(dt):
 | 
	
		
			
				|  |  |          data)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      # ck对应数据也保存一份
 | 
	
		
			
				|  |  | -    # 1,获取到所有分区
 | 
	
		
			
				|  |  | -    ck_partitions = ck.execute(f'''
 | 
	
		
			
				|  |  | -    select partition
 | 
	
		
			
				|  |  | -    from `system`.parts p 
 | 
	
		
			
				|  |  | -    where table='dw_image_cost_day'
 | 
	
		
			
				|  |  | -    and `partition` like '%{dt}%'
 | 
	
		
			
				|  |  | -    ''')
 | 
	
		
			
				|  |  | -    # 2.进行当天相关的分区删除
 | 
	
		
			
				|  |  | -    for i in ck_partitions:
 | 
	
		
			
				|  |  | -        ck.client.execute(''' alter table dw_image_cost_day drop partition ''' + i[0])
 | 
	
		
			
				|  |  | +    # 1.进行当天相关的分区删除
 | 
	
		
			
				|  |  | +    ck.client.execute(f''' alter table dw_image_cost_day drop partition '{dt}' ''' )
 | 
	
		
			
				|  |  |      col = ['dt', 'type', 'use_times', 'cost', 'view_count', 'click_count',
 | 
	
		
			
				|  |  |             'follow_count', 'order_count', 'order_amount', 'title', 'description',
 | 
	
		
			
				|  |  |             'book', 'platform', 'stage', 'channel', 'pitcher', 'image_id', 'preview_url',
 | 
	
	
		
			
				|  | @@ -179,7 +171,7 @@ def day():
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if __name__ == '__main__':
 | 
	
		
			
				|  |  |      # run('2021-05-18')
 | 
	
		
			
				|  |  | -    #-495
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      logging.basicConfig(
 | 
	
		
			
				|  |  |          handlers=[
 | 
	
		
			
				|  |  |              logging.handlers.RotatingFileHandler('.ad_hourly.log',
 | 
	
	
		
			
				|  | @@ -191,8 +183,9 @@ if __name__ == '__main__':
 | 
	
		
			
				|  |  |          level=logging.INFO,
 | 
	
		
			
				|  |  |          format="%(asctime)s - %(levelname)s %(filename)s %(funcName)s %(lineno)s - %(message)s"
 | 
	
		
			
				|  |  |      )
 | 
	
		
			
				|  |  | -    for i in du.getDateLists(du.get_n_days(-370), du.get_n_days(0)):
 | 
	
		
			
				|  |  | -        print(i)
 | 
	
		
			
				|  |  | -        run(i)
 | 
	
		
			
				|  |  | -    # print(du.getNow())
 | 
	
		
			
				|  |  | -    # run(du.getNow())
 | 
	
		
			
				|  |  | +    #-495
 | 
	
		
			
				|  |  | +    # for i in du.getDateLists(du.get_n_days(-495), du.get_n_days(0)):
 | 
	
		
			
				|  |  | +    #     print(i)
 | 
	
		
			
				|  |  | +    #     run(i)
 | 
	
		
			
				|  |  | +    print(du.getNow())
 | 
	
		
			
				|  |  | +    run(du.get_n_days(-1))
 |