From b1a78922689ce4845e4598920bf4bc86a12f6c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Wed, 18 Jun 2025 09:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E5=9B=B4=E6=A0=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/company/company/fill_company_comm.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dags/company/company/fill_company_comm.py b/dags/company/company/fill_company_comm.py index 0335a0e..e5a04b4 100644 --- a/dags/company/company/fill_company_comm.py +++ b/dags/company/company/fill_company_comm.py @@ -9,6 +9,11 @@ log = logging.getLogger(__name__) def sync(province): log.info(f"开始同步{province}企业数据的居委村委数据") + shape_df = DIDATA_DEV_ELASTIC_CLIENT.scan_by_sql_to_data_frame( + f"select city_name, area_name, street_name, name, shape from community where province_name='{province}'") + if len(shape_df) == 0 or 'shape' not in shape_df.columns or len(shape_df[shape_df['shape'].notna()]) == 0: + log.info(f"{province}无围栏数据") + return # 先临时禁用索引刷新 DIDATA_DEV_ELASTIC_CLIENT.elastic_client.indices.put_settings( index="didata_company", @@ -19,10 +24,6 @@ def sync(province): company_ids = ids['_id'].to_list() else: company_ids = list() - shape_df = DIDATA_DEV_ELASTIC_CLIENT.scan_by_sql_to_data_frame(f"select city_name, area_name, street_name, name, shape from community where province_name='{province}'") - if len(shape_df) == 0 or 'shape' not in shape_df.columns or len(shape_df[shape_df['shape'].notna()]) == 0: - log.info(f"{province}无围栏数据") - return actions = list() count = 0 errors = list()