feat: ClickHouse 彻底下线并平替为 MongoDB tmp 库,新增 ES 206 均价至 MongoDB 85 月度同步任务
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, ClickHouseClient
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils
|
||||
from elasticsearch import helpers
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import sys
|
||||
@@ -12,7 +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.89', username='elastic', password='elasticsearch')
|
||||
tmp_ck = ClickHouseClient(database='tmp')
|
||||
community_summary_conn = MAIN_MONGO_CLIENT.get_collection('tmp', 'community_summary')
|
||||
|
||||
index_name = "community_summary"
|
||||
path = "/home/airflow/data/community"
|
||||
@@ -33,10 +33,10 @@ def build_doc(item):
|
||||
def sync(city=None):
|
||||
log.info(f"开始同步出售信息至206 {index_name}")
|
||||
|
||||
tmp_sql = f"select * from community_summary "
|
||||
query = {}
|
||||
if pd.notna(city):
|
||||
tmp_sql += f" where city='{city}'"
|
||||
seaweed_df = tmp_ck.read_sql_query(tmp_sql)
|
||||
query['city'] = city
|
||||
seaweed_df = pd.DataFrame(list(community_summary_conn.find(query)))
|
||||
|
||||
with ThreadPoolExecutor(30) as pool:
|
||||
def deal(index, item):
|
||||
|
||||
Reference in New Issue
Block a user