renyupeng 2 年之前
父节点
当前提交
889b1f187e
共有 1 个文件被更改,包括 129 次插入128 次删除
  1. 129 128
      Apietl/bytedance_etl/report/NewMaterialImageDailyReport.py

+ 129 - 128
Apietl/bytedance_etl/report/NewMaterialImageDailyReport.py

@@ -118,7 +118,7 @@ select report.advertiser_id account_id,      #'账户ID'
        image.filename,
        image.filename,
        report.stat_cost,
        report.stat_cost,
        report.show_cnt,
        report.show_cnt,
-       '' as                show_cost,
+       0 as                show_cost,
        report.`convert_cnt`,
        report.`convert_cnt`,
        report.`cpc_platform`,
        report.`cpc_platform`,
        report.`ctr`,
        report.`ctr`,
@@ -128,17 +128,17 @@ select report.advertiser_id account_id,      #'账户ID'
        report.`deep_convert_cnt`,
        report.`deep_convert_cnt`,
        report.`deep_convert_cost`,
        report.`deep_convert_cost`,
        report.`deep_convert_rate`,
        report.`deep_convert_rate`,
-       '' as                `attribution_convert`,
-       '' as                `attribution_convert_cost`,
-       '' as                `attribution_deep_convert`,
-       '' as                `attribution_deep_convert_cost`,
+       0 as                `attribution_convert`,
+       0 as                `attribution_convert_cost`,
+       0 as                `attribution_deep_convert`,
+       0 as                `attribution_deep_convert_cost`,
        report.`click_start_cnt`,
        report.`click_start_cnt`,
        report.`click_start_cost`,
        report.`click_start_cost`,
        report.`click_start_rate`,
        report.`click_start_rate`,
        report.`download_finish_cnt`,
        report.`download_finish_cnt`,
        report.`download_finish_cost`,
        report.`download_finish_cost`,
        report.`download_finish_rate`,
        report.`download_finish_rate`,
-       '' as                `click_install`,
+       0 as                `click_install`,
        report.`install_finish_cnt`,
        report.`install_finish_cnt`,
        report.`install_finish_cost`,
        report.`install_finish_cost`,
        report.`install_finish_rate`,
        report.`install_finish_rate`,
@@ -148,27 +148,27 @@ select report.advertiser_id account_id,      #'账户ID'
        report.`active_register`,
        report.`active_register`,
        report.`active_register_cost`,
        report.`active_register_cost`,
        report.`active_register_rate`,
        report.`active_register_rate`,
-       '' as                `active_pay_amount`,
+       0 as                `active_pay_amount`,
        report.`next_day_open`,
        report.`next_day_open`,
-       '' as                `next_day_open_cost`,
-       '' as                `next_day_open_rate`,
+       0 as                `next_day_open_cost`,
+       0 as                `next_day_open_rate`,
        report.`attribution_next_day_open_cnt`,
        report.`attribution_next_day_open_cnt`,
        report.`attribution_next_day_open_cost`,
        report.`attribution_next_day_open_cost`,
        report.`attribution_next_day_open_rate`,
        report.`attribution_next_day_open_rate`,
        report.`game_addiction`,
        report.`game_addiction`,
        report.`game_addiction_cost`,
        report.`game_addiction_cost`,
        report.`game_addiction_rate`,
        report.`game_addiction_rate`,
-       '' as                `cnt`,
+       0 as                `cnt`,
        report.`active_pay_cost`,
        report.`active_pay_cost`,
        report.`active_pay_rate`,
        report.`active_pay_rate`,
-       '' as                `loan_completion`,
-       '' as                `loan_completion_cost`,
-       '' as                `loan_completion_rate`,
-       '' as                `pre_loan_credit`,
-       '' as                `pre_loan_credit_cost`,
-       '' as                `loan_credit`,
-       '' as                `loan_credit_cost`,
-       '' as                `loan_credit_rate`,
+       0 as                `loan_completion`,
+       0 as                `loan_completion_cost`,
+       0 as                `loan_completion_rate`,
+       0 as                `pre_loan_credit`,
+       0 as                `pre_loan_credit_cost`,
+       0 as                `loan_credit`,
+       0 as                `loan_credit_cost`,
+       0 as                `loan_credit_rate`,
        report.`in_app_uv`,
        report.`in_app_uv`,
        report.`in_app_detail_uv`,
        report.`in_app_detail_uv`,
        report.`in_app_cart`,
        report.`in_app_cart`,
@@ -176,118 +176,118 @@ select report.advertiser_id account_id,      #'账户ID'
        report.`in_app_order`,
        report.`in_app_order`,
        report.`attribution_game_pay_7d_count`,
        report.`attribution_game_pay_7d_count`,
        report.`attribution_game_pay_7d_cost`,
        report.`attribution_game_pay_7d_cost`,
-       '' as                `attribution_active_pay_7d_per_count`,
+       0 as                `attribution_active_pay_7d_per_count`,
        report.`game_pay_cost`,
        report.`game_pay_cost`,
        report.`game_pay_count`,
        report.`game_pay_count`,
-       '' as                `phone`,
-       '' as                `form`,
-       '' as                `map_search`,
-       '' as                `button`,
-       '' as                `view`,
-       '' as                `download`,
-       '' as                `qq`,
-       '' as                `lottery`,
-       '' as                `vote`,
-       '' as                `message`,
-       '' as                `redirect`,
-       '' as                `shopping`,
-       '' as                `consult`,
-       '' as                `wechat`,
-       '' as                `phone_confirm`,
-       '' as                `phone_connect`,
-       '' as                `consult_effective`,
-       '' as                `coupon`,
-       '' as                `coupon_single_page`,
-       '' as                `redirect_to_shop`,
-       '' as                `poi_collect`,
-       '' as                `poi_address_click`,
-       '' as                `luban_order_cnt`,
-       '' as                `luban_order_stat_amount`,
-       '' as                `luban_order_roi`,
-       '' as                `luban_live_enter_cnt`,
-       '' as                `live_watch_one_minute_count`,
-       '' as                `luban_live_follow_cnt`,
-       '' as                `live_fans_club_join_cnt`,
-       '' as                `luban_live_comment_cnt`,
-       '' as                `luban_live_share_cnt`,
-       '' as                `luban_live_gift_cnt`,
-       '' as                `luban_live_gift_amount`,
-       '' as                `luban_live_slidecart_click_cnt`,
-       '' as                `luban_live_click_product_cnt`,
-       '' as                `luban_live_pay_order_count`,
-       '' as                `luban_live_pay_order_stat_cost`,
-       '' as                `wechat_login_count`,
-       '' as                `attribution_wechat_login_30d_count`,
-       '' as                `wechat_login_cost`,
-       '' as                `attribution_wechat_login_30d_cost`,
-       '' as                `wechat_first_pay_count`,
-       '' as                `attribution_wechat_first_pay_30d_count`,
-       '' as                `wechat_first_pay_cost`,
-       '' as                `attribution_wechat_first_pay_30d_cost`,
-       '' as                `wechat_first_pay_rate`,
-       '' as                `attribution_wechat_first_pay_30d_rate`,
-       '' as                `wechat_pay_amount`,
-       '' as                `attribution_wechat_pay_30d_amount`,
-       '' as                `attribution_wechat_pay_30d_roi`,
-       '' as                `phone_effective`,
-       '' as                `total_play`,
-       '' as                `valid_play`,
-       '' as                `valid_play_cost`,
-       '' as                `valid_play_rate`,
-       '' as                `play_25_feed_break`,
-       '' as                `play_50_feed_break`,
-       '' as                `play_75_feed_break`,
-       '' as                `play_100_feed_break`,
-       '' as                `average_play_time_per_play`,
-       '' as                `play_over_rate`,
-       '' as                `wifi_play_rate`,
-       '' as                `wifi_play`,
-       '' as                `play_duration_sum`,
-       '' as                `advanced_creative_phone_click`,
-       '' as                `advanced_creative_counsel_click`,
-       '' as                `advanced_creative_form_click`,
-       '' as                `advanced_creative_coupon_addition`,
-       '' as                `advanced_creative_form_submit`,
-       '' as                `card_show`,
-       '' as                `share`,
-       '' as                `comment`,
-       '' as                `like`,
-       '' as                `follow`,
-       '' as                `home_visited`,
-       '' as                `ies_challenge_click`,
-       '' as                `ies_music_click`,
-       '' as                `location_click`,
-       '' as                `message_action`,
-       '' as                `click_landing_page`,
-       '' as                `click_shopwindow`,
-       '' as                `click_website`,
-       '' as                `click_download`,
-       '' as                `click_call_dy`,
-       '' as                `cpc`,
-       '' as                `cpm`,
-       '' as                `cpa`,
-       '' as                `interact_per_cost`,
-       '' as                `convert_show_rate`,
-       '' as                `play_duration_10s_rate`,
-       '' as                `play_50_feed_break_rate`,
-       '' as                `play_25_feed_break_rate`,
-       '' as                `play_duration_5s_rate`,
-       '' as                `play_duration_2s_rate`,
-       '' as                `average_play_progress`,
-       '' as                `play_100_feed_break_rate`,
-       '' as                `play_duration_3s_rate`,
-       '' as                `play_75_feed_break_rate`,
-       '' as                `play_duration`,
-       '' as                `play_duration_3s`,
-       '' as                `play_duration_2s`,
-       '' as                `play_duration_10s`,
-       '' as                `average_video_play`,
-       '' as                `avg_rank`,
-       '' as                `submit_certification_count`,
-       '' as                `approval_count`,
-       '' as                `first_order_count`,
-       '' as                `first_rental_order_count`,
-       '' as                `commute_first_pay_count`,
+       0 as                `phone`,
+       0 as                `form`,
+       0 as                `map_search`,
+       0 as                `button`,
+       0 as                `view`,
+       0 as                `download`,
+       0 as                `qq`,
+       0 as                `lottery`,
+       0 as                `vote`,
+       0 as                `message`,
+       0 as                `redirect`,
+       0 as                `shopping`,
+       0 as                `consult`,
+       0 as                `wechat`,
+       0 as                `phone_confirm`,
+       0 as                `phone_connect`,
+       0 as                `consult_effective`,
+       0 as                `coupon`,
+       0 as                `coupon_single_page`,
+       0 as                `redirect_to_shop`,
+       0 as                `poi_collect`,
+       0 as                `poi_address_click`,
+       0 as                `luban_order_cnt`,
+       0 as                `luban_order_stat_amount`,
+       0 as                `luban_order_roi`,
+       0 as                `luban_live_enter_cnt`,
+       0 as                `live_watch_one_minute_count`,
+       0 as                `luban_live_follow_cnt`,
+       0 as                `live_fans_club_join_cnt`,
+       0 as                `luban_live_comment_cnt`,
+       0 as                `luban_live_share_cnt`,
+       0 as                `luban_live_gift_cnt`,
+       0 as                `luban_live_gift_amount`,
+       0 as                `luban_live_slidecart_click_cnt`,
+       0 as                `luban_live_click_product_cnt`,
+       0 as                `luban_live_pay_order_count`,
+       0 as                `luban_live_pay_order_stat_cost`,
+       0 as                `wechat_login_count`,
+       0 as                `attribution_wechat_login_30d_count`,
+       0 as                `wechat_login_cost`,
+       0 as                `attribution_wechat_login_30d_cost`,
+       0 as                `wechat_first_pay_count`,
+       0 as                `attribution_wechat_first_pay_30d_count`,
+       0 as                `wechat_first_pay_cost`,
+       0 as                `attribution_wechat_first_pay_30d_cost`,
+       0 as                `wechat_first_pay_rate`,
+       0 as                `attribution_wechat_first_pay_30d_rate`,
+       0 as                `wechat_pay_amount`,
+       0 as                `attribution_wechat_pay_30d_amount`,
+       0 as                `attribution_wechat_pay_30d_roi`,
+       0 as                `phone_effective`,
+       0 as                `total_play`,
+       0 as                `valid_play`,
+       0 as                `valid_play_cost`,
+       0 as                `valid_play_rate`,
+       0 as                `play_25_feed_break`,
+       0 as                `play_50_feed_break`,
+       0 as                `play_75_feed_break`,
+       0 as                `play_100_feed_break`,
+       0 as                `average_play_time_per_play`,
+       0 as                `play_over_rate`,
+       0 as                `wifi_play_rate`,
+       0 as                `wifi_play`,
+       0 as                `play_duration_sum`,
+       0 as                `advanced_creative_phone_click`,
+       0 as                `advanced_creative_counsel_click`,
+       0 as                `advanced_creative_form_click`,
+       0 as                `advanced_creative_coupon_addition`,
+       0 as                `advanced_creative_form_submit`,
+       0 as                `card_show`,
+       0 as                `share`,
+       0 as                `comment`,
+       0 as                `like`,
+       0 as                `follow`,
+       0 as                `home_visited`,
+       0 as                `ies_challenge_click`,
+       0 as                `ies_music_click`,
+       0 as                `location_click`,
+       0 as                `message_action`,
+       0 as                `click_landing_page`,
+       0 as                `click_shopwindow`,
+       0 as                `click_website`,
+       0 as                `click_download`,
+       0 as                `click_call_dy`,
+       0 as                `cpc`,
+       0 as                `cpm`,
+       0 as                `cpa`,
+       0 as                `interact_per_cost`,
+       0 as                `convert_show_rate`,
+       0 as                `play_duration_10s_rate`,
+       0 as                `play_50_feed_break_rate`,
+       0 as                `play_25_feed_break_rate`,
+       0 as                `play_duration_5s_rate`,
+       0 as                `play_duration_2s_rate`,
+       0 as                `average_play_progress`,
+       0 as                `play_100_feed_break_rate`,
+       0 as                `play_duration_3s_rate`,
+       0 as                `play_75_feed_break_rate`,
+       0 as                `play_duration`,
+       0 as                `play_duration_3s`,
+       0 as                `play_duration_2s`,
+       0 as                `play_duration_10s`,
+       0 as                `average_video_play`,
+       0 as                `avg_rank`,
+       0 as                `submit_certification_count`,
+       0 as                `approval_count`,
+       0 as                `first_order_count`,
+       0 as                `first_rental_order_count`,
+       0 as                `commute_first_pay_count`,
        image.image_url,
        image.image_url,
        image.signature
        image.signature
 from media_api.bytedance_material_image_daily report
 from media_api.bytedance_material_image_daily report
@@ -313,6 +313,7 @@ where report.stat_datetime = {start_time}
             TidbConn.upsert(conn=self.conn, sql_buff=sql)
             TidbConn.upsert(conn=self.conn, sql_buff=sql)
             self.conn.commit()
             self.conn.commit()
             TidbConn.conn_close(conn=self.conn)
             TidbConn.conn_close(conn=self.conn)
+            return 0
         except Exception as e:
         except Exception as e:
             logging.error(e)
             logging.error(e)
             return -1
             return -1