From 6eca8a9f3be9b4370380381b11f34fe9ee134717 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Fri, 5 Jul 2024 13:09:51 +0800 Subject: [PATCH] update sql explanation results --- .../pipelines/sql_explanation/generation.py | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/wren-ai-service/src/pipelines/sql_explanation/generation.py b/wren-ai-service/src/pipelines/sql_explanation/generation.py index 5dfefa4741..5223964238 100644 --- a/wren-ai-service/src/pipelines/sql_explanation/generation.py +++ b/wren-ai-service/src/pipelines/sql_explanation/generation.py @@ -269,14 +269,23 @@ def run( "selectItems" in preprocessed_sql_analysis_results and "selectItems" in sql_explanation_results ): - sql_analysis_result_for_select_items = ( - preprocessed_sql_analysis_results["selectItems"][ - "withFunctionCallOrMathematicalOperation" - ] - + preprocessed_sql_analysis_results["selectItems"][ - "withoutFunctionCallOrMathematicalOperation" - ] - ) + sql_analysis_result_for_select_items = [ + { + **select_item, + "type": "withFunctionCallOrMathematicalOperation", + } + for select_item in preprocessed_sql_analysis_results[ + "selectItems" + ]["withFunctionCallOrMathematicalOperation"] + ] + [ + { + **select_item, + "type": "withoutFunctionCallOrMathematicalOperation", + } + for select_item in preprocessed_sql_analysis_results[ + "selectItems" + ]["withoutFunctionCallOrMathematicalOperation"] + ] for ( select_item,