feat: ClickHouse 彻底下线并平替为 MongoDB tmp 库,新增 ES 206 均价至 MongoDB 85 月度同步任务

This commit is contained in:
王文艳
2026-08-17 09:08:45 +08:00
parent 6dae2f895c
commit d04bdbd464
15 changed files with 333 additions and 64 deletions
+5 -5
View File
@@ -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):