Commit 33c3ec0c authored by litaolemo's avatar litaolemo

update

parent c0b50e3f
...@@ -465,7 +465,7 @@ def craw_query_one_week(data_index, start_ts, end_ts, week_num, last_week_num, y ...@@ -465,7 +465,7 @@ def craw_query_one_week(data_index, start_ts, end_ts, week_num, last_week_num, y
if __name__ == "__main__": if __name__ == "__main__":
data_index, start_ts, end_ts, week_num, last_week_num, year = week_num() data_index, start_ts, end_ts, week_num, last_week_num, year = week_num()
start_ts = 1596988800000 start_ts = 1597593600000
craw_one_week = get_how_word_crawler_count(data_index, start_ts, end_ts, week_num, last_week_num, year) craw_one_week = get_how_word_crawler_count(data_index, start_ts, end_ts, week_num, last_week_num, year)
word_count = get_keyword_ctr(start_ts, end_ts) word_count = get_keyword_ctr(start_ts, end_ts)
# 一周爬虫抓取热点数 # 一周爬虫抓取热点数
......
...@@ -72,8 +72,8 @@ spark.sql("CREATE TEMPORARY FUNCTION json_map AS 'brickhouse.udf.json.JsonMapUDF ...@@ -72,8 +72,8 @@ spark.sql("CREATE TEMPORARY FUNCTION json_map AS 'brickhouse.udf.json.JsonMapUDF
spark.sql("CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJsonFormatCheck'") spark.sql("CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJsonFormatCheck'")
spark.sql("CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDFArryMerge'") spark.sql("CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDFArryMerge'")
select_sql = """SELECT *,NVL(ROUND(wel_click_pv/wel_exp_pv,5),0) as meigou_ctr, select_sql = """SELECT *,NVL(ROUND(wel_click_pv/wel_exp_pv,6),0) as meigou_ctr,
NVL(ROUND(content_click_pv/content_exp_pv,5),0) as neirong_ctr FROM pm.tl_pm_contentpage_ctr""" NVL(ROUND(content_click_pv/content_exp_pv,6),0) as neirong_ctr FROM pm.tl_pm_contentpage_ctr"""
device_df = spark.sql(select_sql) device_df = spark.sql(select_sql)
device_df.show(1, False) device_df.show(1, False)
sql_res = device_df.collect() sql_res = device_df.collect()
...@@ -114,4 +114,6 @@ for res in sql_res: ...@@ -114,4 +114,6 @@ for res in sql_res:
db.commit() db.commit()
print(res) print(res)
# cursor.executemany() # cursor.executemany()
db.close() db.close()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment