Commit f6b1f9ac authored by litaolemo's avatar litaolemo

update

parent 19b6157d
...@@ -189,7 +189,7 @@ for t in range(0, task_days): ...@@ -189,7 +189,7 @@ for t in range(0, task_days):
sql_res = search_ctr_df.collect() sql_res = search_ctr_df.collect()
tag_names_list_week = [] tag_names_list_week = []
for name in sql_res: for name in sql_res:
print(name) # print(name)
word = name.query word = name.query
nums = name.all_search_pv nums = name.all_search_pv
uv = name.all_search_uv uv = name.all_search_uv
...@@ -204,10 +204,12 @@ for t in range(0, task_days): ...@@ -204,10 +204,12 @@ for t in range(0, task_days):
for count, item in enumerate(tag_names_list_week): for count, item in enumerate(tag_names_list_week):
word, nums, uv,partition_date = item word, nums, uv,partition_date = item
try: try:
if len(word) >= 200:
continue
pid = hashlib.md5((partition_date + word).encode("utf8")).hexdigest() pid = hashlib.md5((partition_date + word).encode("utf8")).hexdigest()
insert_sql_tuple = (word, nums, uv, pid, partition_date) insert_sql_tuple = (word, nums, uv, pid, partition_date)
insert_list.append(insert_sql_tuple) insert_list.append(insert_sql_tuple)
print(insert_sql_tuple) # print(insert_sql_tuple)
except: except:
continue continue
if count % 100 == 0: if count % 100 == 0:
...@@ -216,7 +218,7 @@ for t in range(0, task_days): ...@@ -216,7 +218,7 @@ for t in range(0, task_days):
db.commit() db.commit()
# print(res) # print(res)
insert_list = [] insert_list = []
print(count) # print(count)
res = cursor.executemany(insert_sql, insert_list) res = cursor.executemany(insert_sql, insert_list)
db.commit() db.commit()
db.close() db.close()
......
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