From 8fdb043e59c3c9c74a475390e46798ec2b15154c Mon Sep 17 00:00:00 2001 From: aries_ckt <916701291@qq.com> Date: Wed, 10 Apr 2024 20:34:14 +0800 Subject: [PATCH] fix:datasource run data error --- dbgpt/app/scene/chat_dashboard/data_loader.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dbgpt/app/scene/chat_dashboard/data_loader.py b/dbgpt/app/scene/chat_dashboard/data_loader.py index 2a67a5e62..38ffe3be2 100644 --- a/dbgpt/app/scene/chat_dashboard/data_loader.py +++ b/dbgpt/app/scene/chat_dashboard/data_loader.py @@ -40,16 +40,16 @@ def get_chart_values_by_data(self, field_names, datas, chart_sql: str): ) for field_name in field_names[1:]: - # if not field_map[field_name]: - # logger.info("More than 2 non-numeric column:" + field_name) - # else: - for data in datas: - value_item = ValueItem( - name=data[0], - type=field_name, - value=str(data[field_names.index(field_name)]), - ) - values.append(value_item) + if not field_map[field_name]: + logger.info("More than 2 non-numeric column:" + field_name) + else: + for data in datas: + value_item = ValueItem( + name=data[0], + type=field_name, + value=str(data[field_names.index(field_name)]), + ) + values.append(value_item) return field_names, values except Exception as e: logger.debug("Prepare Chart Data Failed!" + str(e))