michael-s-molina commented on code in PR #36739:
URL: https://github.com/apache/superset/pull/36739#discussion_r2634848064


##########
superset/mcp_service/sql_lab/tool/execute_sql.py:
##########
@@ -92,3 +138,55 @@ async def execute_sql(request: ExecuteSqlRequest, ctx: 
Context) -> ExecuteSqlRes
             )
         )
         raise
+
+
+def _convert_to_response(result: QueryResult) -> ExecuteSqlResponse:
+    """Convert QueryResult to ExecuteSqlResponse."""
+    if result.status != QueryStatus.SUCCESS:
+        return ExecuteSqlResponse(
+            success=False,
+            error=result.error_message,
+            error_type=result.status.value,
+        )
+
+    # Build statement info list
+    statements = [
+        StatementInfo(
+            original_sql=stmt.original_sql,
+            executed_sql=stmt.executed_sql,
+            row_count=stmt.row_count,
+            execution_time_ms=stmt.execution_time_ms,
+        )
+        for stmt in result.statements
+    ]
+
+    # Get first statement's data for backward compatibility
+    first_stmt = result.statements[0] if result.statements else None

Review Comment:
   Type can't be `None`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to