You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/11/04 15:08:16 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #17287: fix(dashboard): Return columns and verbose_map for groupby values of Pivot Table v2 [ID-7]

zhaoyongjie commented on a change in pull request #17287:
URL: https://github.com/apache/superset/pull/17287#discussion_r742930163



##########
File path: superset/connectors/base/models.py
##########
@@ -317,11 +317,23 @@ def data_for_slices(self, slices: List[Slice]) -> Dict[str, Any]:
                 if "column" in filter_config
             )
 
-            column_names.update(
-                column
-                for column_param in COLUMN_FORM_DATA_PARAMS
-                for column in utils.get_iterable(form_data.get(column_param) or [])
-            )
+            # legacy charts don't have query_context charts
+            if slc.query_context:
+                query_context = slc.get_query_context()
+                column_names.update(
+                    [
+                        column
+                        for query in query_context.get("queries", [])
+                        for column in query.get("columns", [])
+                    ]
+                    or []
+                )
+            else:
+                column_names.update(
+                    column
+                    for column_param in COLUMN_FORM_DATA_PARAMS
+                    for column in utils.get_iterable(form_data.get(column_param) or [])
+                )

Review comment:
       I think just add `groupbyColumns` and `groupbyRows` into COLUMN_FORM_DATA_PARAMS
   
   ````
   COLUMN_FORM_DATA_PARAMS = [
       "all_columns",
       "all_columns_x",
       "columns",
       "entity",
       "groupby",
       "order_by_cols",
       "series",
       "groupbyColumns",
       "groupbyRows",
   ]
   ```
   




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org