From 17aee7f58f71ce4fac9c0200af73fd05eb914adc Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Mon, 4 Jul 2022 14:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=8B=E5=B7=A5=E7=82=B9?= =?UTF-8?q?=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/stat/community/community_count_price_rent.py | 3 +++ 1 file changed, 3 insertions(+) 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')