Commit 9ccb4ad5 by lzzzzl

更新attr_values mongo处理

parent 471629f8
Showing with 4 additions and 0 deletions
......@@ -47,9 +47,11 @@ class ParamMongo(Task):
mycol.save(mg_dt)
def update_mongo(self, data):
count = 0
class_db = self.DBConn.db_class()
for row in data:
try:
count += 1
spu_id = row[0]
attr_values = json.loads(row[1])
new_av_list = list()
......@@ -61,6 +63,8 @@ class ParamMongo(Task):
if attr_name and attr_value and attr_unit:
new_av_list.append({'attr_name': attr_name, 'attr_value': attr_value, 'attr_unit': attr_unit})
self.search_mongo(spu_id, new_av_list)
if count % 10000 == 0:
print(count)
except:
traceback.print_exc()
......
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 sign in to comment