diff --git a/dags/stat/community/community_count_price_rent.py b/dags/stat/community/community_count_price_rent.py index ec6c2c5..3dc3fbe 100644 --- a/dags/stat/community/community_count_price_rent.py +++ b/dags/stat/community/community_count_price_rent.py @@ -68,6 +68,9 @@ df = df.round({'avg_price_coverage': 2, 'sqmetre_rent_coverage': 2}) df = df[['city', 'community_count', 'city_level', 'avg_price_count', 'avg_price_coverage', 'sqmetre_rent_count', 'sqmetre_rent_coverage']] df['weekend'] = dateutils.datetime.datetime.now() +# 删除本日生成的重复数据,防止手工点击生成 +clickHouseClient.execute( + "ALTER TABLE fangjia_stat.community_coverage_stat DELETE WHERE weekend = toDate('" + dateutils.format_date(dateutils.datetime.datetime.now(), '%Y-%m-%d') + "')") clickHouseClient.to_sql(df, table='community_coverage_stat', if_exists='insert', order_by='weekend')