Incubator-superset: Preserve Column Order in Table CSV Export

Created on 1 Jul 2020  路  6Comments  路  Source: apache/incubator-superset

I am experiencing this new issue with superset 36.

I am pretty sure in the previous versions of superset Table exported in CSV had column order preserved.
I also have trouble exporting CSV data with 'latin-1' encoding, which I did not have before

Is this possible or I am dreaming and it never worked ? :/

#bug

All 6 comments

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.59. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I come back on this issue, the problem is still not resolved with superset 37.
Here is an example :

The chart :

Screenshot 2020-08-12 at 15 46 45

and the CSV export :

Screenshot 2020-08-12 at 15 46 50

As you can see, the columns' order is modified and additionally the names of the columns were replaced by the variables :(

I have the same issue, and it can be quite annoying for tables with many columns

I found out the problem (at least for the table export) comes from this line :
https://github.com/apache/incubator-superset/blob/ca9ca995109ee5251918b9df60980bffaf9b9a24/superset/viz.py#L325

The set function does not preserve the original order , I have seen this list(set( .... )) or set(gb) in many places in the viz.py file.
Is there any better way to preserve columns' order and make sure there is no duplicate?

As a quick fix you could use:

sorted(list(gb + columns), key=list(gb + columns).index)
However, there might be some performance issues if you have many columns.

OR

list(dict.fromkeys(list(gb + columns)).keys())

Hi Lila, our team mentioned that you have been providing valuable product feedbacks and requests in the community. I would like to invite you to join Superset new designated user panels. I couldn't find you on Slack, would you mind sharing your email with me and I can share more info with you if you are interested. Thanks! @lilila

Was this page helpful?
0 / 5 - 0 ratings