eschutho commented on PR #32366:
URL: https://github.com/apache/superset/pull/32366#issuecomment-2712262409

   > Thanks @eschutho for taking a look. I had a similar approach to use a 
feature flag [here](https://github.com/apache/superset/pull/29335) but it was 
suggested using the modal would be a better approach so it was not a global 
setting
   
   Hi @SkinnyPigeon I agree, usually it is better to put options like that in a 
modal instead of a config, but in this case, I believe that we can simplify 
this and simply call this extra column a bug. We have heard a bit of feedback 
that most people do not want this column. To @betodealmeida's point in this 
[PR](https://github.com/apache/superset/pull/23155/files) it's ok to remove the 
column, but suggested just to remove it earlier in the process. 
   
   I think a viable approach would be to remove the column in the 
charts/client_processing.py file.. something like this when a default index is 
used:
   ```
   if isinstance(df.index, pd.RangeIndex):
               show_default_index = False
       
           processed_df.columns = [
               (
                   " ".join(str(name) for name in column).strip()
                   if isinstance(column, tuple)
                   else column
               )
               for column in processed_df.columns
           ]
   
           processed_df.index = [
               (
                   " ".join(str(name) for name in index).strip()
                   if isinstance(index, tuple)
                   else index
               )
               for index in processed_df.index
           ]
   
           if query["result_format"] == ChartDataResultFormat.JSON:
               if show_default_index:
                   query["data"] = processed_df.to_dict()
               else:
                   query["data"] = processed_df.to_dict(orient="index")
           elif query["result_format"] == ChartDataResultFormat.CSV:
               buf = StringIO()
               processed_df.to_csv(buf, index=show_default_index)
               buf.seek(0)
               query["data"] = buf.getvalue()
   
       return result
   ```
   Let me know if this helps!


-- 
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-unsubscr...@superset.apache.org

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


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

Reply via email to