美团中间表改造
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
"""
|
||||
小区属性导出
|
||||
"""
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, dateutils, commutils
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, dateutils, commutils, ClickHouseClient
|
||||
import pandas as pd
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed')
|
||||
tmp_ck = ClickHouseClient(database='tmp')
|
||||
|
||||
path = "/home/airflow/data/mt"
|
||||
if not os.path.exists(path):
|
||||
@@ -74,5 +75,9 @@ seaweed_new_result_df = seaweed_new_result_df.rename(columns={'_id': 'id', 'mapp
|
||||
'cubage_percent' : 'plot_ratio', 'virescence_percent': 'landscaping_ratio', 'estate_type2': 'property_type',
|
||||
'main_type': 'house_type', 'main_type_area': 'house_area'})
|
||||
|
||||
seaweed_new_result_df.to_csv(path + '/FJW_COMM_' + output_date + '.csv',
|
||||
sep='@', encoding='utf-8', index=False)
|
||||
seaweed_new_result_df.to_csv(path + '/FJW_COMM_' + output_date + '.csv', sep='@', encoding='utf-8', index=False)
|
||||
|
||||
ck_delete_sql = "ALTER TABLE tmp.mt_community DELETE WHERE 1=1 "
|
||||
tmp_ck.execute(ck_delete_sql)
|
||||
|
||||
tmp_ck.to_sql_plus(seaweed_new_result_df, 'mt_community')
|
||||
|
||||
Reference in New Issue
Block a user