优化中间表
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"""
|
||||
import logging
|
||||
import pandas as pd
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils, ClickHouseClient
|
||||
from elasticsearch import helpers
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import sys
|
||||
@@ -12,6 +12,7 @@ from threading import Lock
|
||||
log = logging.getLogger(__name__)
|
||||
seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed')
|
||||
es206_client = ElasticSearchClient(host='192.168.0.206')
|
||||
tmp_ck = ClickHouseClient(database='tmp')
|
||||
|
||||
index_name = "community_summary"
|
||||
path = "/home/airflow/data/community"
|
||||
@@ -32,10 +33,10 @@ def build_doc(item):
|
||||
def sync(city=None):
|
||||
log.info(f"开始同步出售信息至206 {index_name}")
|
||||
|
||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||
tmp_sql = f"select * from community_summary "
|
||||
if pd.notna(city):
|
||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||
tmp_sql += f" where city='{city}'"
|
||||
seaweed_df = tmp_ck.read_sql_query(tmp_sql)
|
||||
|
||||
with ThreadPoolExecutor(30) as pool:
|
||||
def deal(index, item):
|
||||
|
||||
Reference in New Issue
Block a user