优化
This commit is contained in:
@@ -155,7 +155,7 @@ def sync(city=None):
|
|||||||
# 写入csv文件,防止小区变动导致的后续过程更新报错,
|
# 写入csv文件,防止小区变动导致的后续过程更新报错,
|
||||||
# seaweed_df.to_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8', index=False)
|
# seaweed_df.to_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8', index=False)
|
||||||
# 写入中间表clickhouse,解决多worker节点问题
|
# 写入中间表clickhouse,解决多worker节点问题
|
||||||
tmp_ck.to_sql_plus(seaweed_df[['city', 'region', 'name', 'lng', 'lat', 'alias', 'estate_type2', 'build_type',
|
tmp_ck.to_sql_plus(seaweed_df[['_id', 'city', 'region', 'name', 'lng', 'lat', 'alias', 'estate_type2', 'build_type',
|
||||||
'household_count', 'block', 'estate_charge', 'finish_building_date']], 'community_summary')
|
'household_count', 'block', 'estate_charge', 'finish_building_date']], 'community_summary')
|
||||||
|
|
||||||
actions = list()
|
actions = list()
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def build_doc(item):
|
|||||||
|
|
||||||
|
|
||||||
def sync_by_city(city):
|
def sync_by_city(city):
|
||||||
seaweed_df = tmp_ck.read_sql_query(f"select id, city, region, name from community_summary where city='{city}'")
|
seaweed_df = tmp_ck.read_sql_query(f"select _id, city, region, name from community_summary where city='{city}'")
|
||||||
if len(seaweed_df) == 0:
|
if len(seaweed_df) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ def sync_by_city(city):
|
|||||||
action = {
|
action = {
|
||||||
"_op_type": "update",
|
"_op_type": "update",
|
||||||
"_index": index_name,
|
"_index": index_name,
|
||||||
"_id": item['id'],
|
"_id": item['_id'],
|
||||||
"doc": doc_info
|
"doc": doc_info
|
||||||
}
|
}
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
|
|||||||
Reference in New Issue
Block a user