Commit bdd38356 authored by litaolemo's avatar litaolemo

update

parent 2798c64b
......@@ -78,7 +78,7 @@ for t in range(0, task_days):
SELECT query,
partition_date,
all_search_uv as all_search_uv, --全部搜索uv
t3.all_search_pv as all_search_pv --全部搜索pv
all_search_pv as all_search_pv --全部搜索pv
FROM (
--搜索pvuv
SELECT query
......@@ -181,14 +181,12 @@ for t in range(0, task_days):
GROUP BY query,partition_date
) t3 order by all_search_uv desc
""".format(start_date=today_str, end_date=yesterday_str)
""".format(start_date=yesterday_str, end_date=today_str)
print(sql_search_ctr)
search_ctr_df = spark.sql(sql_search_ctr)
# spam_pv_df.createOrReplaceTempView("dev_view")
search_ctr_df.show(1)
sql_res = search_ctr_df.collect()
# date_str = yesterday_date.strftime("%Y%m%d")
tag_names_list_week = []
for name in sql_res:
word = name.get("query")
......@@ -208,9 +206,9 @@ for t in range(0, task_days):
pid = hashlib.md5((partition_date + word).encode("utf8")).hexdigest()
insert_sql_tuple = (word, nums, uv, pid, date_str)
insert_list.append(insert_sql_tuple)
# print(insert_sql)
print(insert_sql)
if count % 100 == 0:
# cursor.execute("set names 'UTF8'")
cursor.execute("set names 'UTF8'")
res = cursor.executemany(insert_sql, insert_list)
db.commit()
# print(res)
......
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