Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(viz): export csv with verbose_name #17341

Closed
wants to merge 6 commits into from
Closed

feat(viz): export csv with verbose_name #17341

wants to merge 6 commits into from

Conversation

chuancyzhang
Copy link
Contributor

The column names displayed on the report are inconsistent with the column names of the actual exported csv file, which can sometimes cause confusion. Therefore, I hope to add a feature to make the column names displayed on the report consistent with the column names of the exported csv file.

SUMMARY

Use verbose_map to help the column names of csv export to be consistent with the front-end display.
Because of the revision of the Superset interface, this PR is changed. #10760

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE
image

AFTER
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Use verbose_map to help the column names of csv export to be consistent with the front-end display
@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #17341 (1dc3b4d) into master (1c12167) will decrease coverage by 0.09%.
The diff coverage is 90.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17341      +/-   ##
==========================================
- Coverage   77.19%   77.09%   -0.10%     
==========================================
  Files        1036     1058      +22     
  Lines       55687    56482     +795     
  Branches     7627     7627              
==========================================
+ Hits        42987    43545     +558     
- Misses      12444    12681     +237     
  Partials      256      256              
Flag Coverage Δ
hive ?
mysql 82.10% <90.98%> (+0.08%) ⬆️
postgres 82.11% <90.98%> (+0.08%) ⬆️
presto ?
python 82.20% <90.98%> (-0.33%) ⬇️
sqlite 81.80% <90.98%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/common/query_context.py 92.72% <90.00%> (+1.81%) ⬆️
superset/common/query_context_processor.py 91.13% <91.13%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.27% <0.00%> (-16.56%) ⬇️
superset/db_engine_specs/presto.py 83.50% <0.00%> (-6.87%) ⬇️
superset/tasks/async_queries.py 91.02% <0.00%> (-5.95%) ⬇️
superset/views/api.py 67.18% <0.00%> (-4.25%) ⬇️
superset/views/dashboard/views.py 69.23% <0.00%> (-3.75%) ⬇️
superset/commands/utils.py 97.05% <0.00%> (-2.95%) ⬇️
superset/examples/birth_names.py 71.02% <0.00%> (-2.76%) ⬇️
... and 108 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c12167...1dc3b4d. Read the comment docs.

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Nov 4, 2021

Hi @chuancyzhang , code looks good to me, Could you fix the code style? Thanks for your contribution!

@zhaoyongjie zhaoyongjie changed the title feat(viz): export csv with frontend the same name feat(viz): export csv with verbose_name Nov 4, 2021
@chuancyzhang
Copy link
Contributor Author

Hi @chuancyzhang , code looks good to me, Could you fix the code style? Thanks for your contribution!

OK

@zhaoyongjie
Copy link
Member

What do you think about this change? @villebro

@villebro
Copy link
Member

villebro commented Nov 8, 2021

@zhaoyongjie I personally agree with this change, but I wonder if this is considered a breaking change. Ping @etr2460 @john-bodley , any thoughts on this?

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This request has come up multiple times in the past and I agree that this is probably expected behavior, but would prefer to get more opinions on this before hitting merge.

@zhaoyongjie zhaoyongjie self-requested a review November 11, 2021 11:30
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also approve of the change.

@kamalkeshavani-aiinside
Copy link
Contributor

This request has come up multiple times in the past and I agree that this is probably expected behavior, but would prefer to get more opinions on this before hitting merge.

If there is a concern that this will change the current behavior and can be considered as a breaking change. We can add a checkbox in the control panel(disabled by default) to 'Use Labels in Export CSV'. This will allow users to get this feature without changing the current behavior, as we agree that this feature is needed for sure.

@villebro
Copy link
Member

@kamalkeshavani-aiinside this needs a rebase. I think we can merge this as-is, as adding yet another checkbox will just add clutter IMO.

@zhaoyongjie
Copy link
Member

Hi @chuancyzhang , a friendly notice, this PR need to rebase master. Thanks!

@pull-request-size pull-request-size bot added size/L and removed size/XS labels Dec 6, 2021
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Dec 6, 2021
@chuancyzhang
Copy link
Contributor Author

Hi @chuancyzhang , a friendly notice, this PR need to rebase master. Thanks!

done

@zhaoyongjie
Copy link
Member

Hi @chuancyzhang , a friendly notice, this PR need to rebase master. Thanks!

done

There are conflicts as well.

image

@chuancyzhang
Copy link
Contributor Author

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

@zhaoyongjie
Copy link
Member

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.

image

@chuancyzhang
Copy link
Contributor Author

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.

image

I thought the wrong way at the time, which caused patch-3 to fail to rebase, which resulted in so many changes.

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Dec 6, 2021

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.
image

I thought the wrong way at the time, which caused patch-3 to fail to rebase, which resulted in so many changes.

Yep, there are a couple of changes recently in the codebase. The get_data method has moved into query_context_processor.py. I think you can cherry-pick original change into that.

If you have any questions, please ping me.

@chuancyzhang
Copy link
Contributor Author

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.
image

I thought the wrong way at the time, which caused patch-3 to fail to rebase, which resulted in so many changes.

Yep, there are a couple of changes recently in the codebase. The get_data method has moved into query_context_processor.py. I think you can cherry-pick original change into that.

If you have any questions, please ping me.

I reopened a PR #17657 again, you can look at this

@zhaoyongjie
Copy link
Member

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.
image

I thought the wrong way at the time, which caused patch-3 to fail to rebase, which resulted in so many changes.

Yep, there are a couple of changes recently in the codebase. The get_data method has moved into query_context_processor.py. I think you can cherry-pick original change into that.
If you have any questions, please ping me.

I reopened a PR #17657 again, you can look at this

Thanks! Do you mind I close this PR, then we can link new PR to this.

@chuancyzhang
Copy link
Contributor Author

Please refer to PR #17657 .This PR, my rebase failed. @zhaoyongjie @villebro

I think you don't need to a lot of changes to this PR. please double check.
image

I thought the wrong way at the time, which caused patch-3 to fail to rebase, which resulted in so many changes.

Yep, there are a couple of changes recently in the codebase. The get_data method has moved into query_context_processor.py. I think you can cherry-pick original change into that.
If you have any questions, please ping me.

I reopened a PR #17657 again, you can look at this

Thanks! Do you mind I close this PR, then we can link new PR to this.

no problem. thanks for you help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants