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

fix: Add impersonate_user setting to import/export datasource #14718

Closed
wants to merge 1 commit into from

Conversation

itay
Copy link

@itay itay commented May 19, 2021

When exporting or importing a datasource/DB, it is necessary get the impersonate_user setting, as it is a key part of the configuration of that datasource. This unfortunately requires a code change, as this list of fields is whitelisted today.

SUMMARY

The UI lets a user control whether a particular datasource supports impersonation, which is very helpful when creating it interactively. However, when exporting the datasource or importing it programmatically, the value for impersonate_user is not exported/imported, leading to a gap in functionality.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@itay itay changed the title Add impersonate_user setting to import/export datasource fix: Add impersonate_user setting to import/export datasource May 19, 2021
@villebro
Copy link
Member

@itay sorry for the long delay, but would you be able to rebase this PR to resolve the conflict? The fix looks legit but just got buried under other PRs 🙁

@itay
Copy link
Author

itay commented Nov 19, 2021

@villebro done - hope it helps, would be great to have it merged.

@villebro
Copy link
Member

@itay LGTM, but it appears you need to update the failing tests

When exporting or importing a datasource/DB, it is necessary get the impersonate_user setting, as it is a key part of the configuration of that datasource. This unfortunately requires a code change, as this list of fields is whitelisted today.
@itay
Copy link
Author

itay commented Nov 29, 2021

@villebro let's see if this update resolves it

@codecov
Copy link

codecov bot commented Nov 29, 2021

Codecov Report

Merging #14718 (2cc9d3a) into master (8e1619b) will increase coverage by 0.26%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14718      +/-   ##
==========================================
+ Coverage   76.75%   77.01%   +0.26%     
==========================================
  Files        1043     1047       +4     
  Lines       56376    56565     +189     
  Branches     7797     7797              
==========================================
+ Hits        43269    43565     +296     
+ Misses      12851    12744     -107     
  Partials      256      256              
Flag Coverage Δ
hive 81.61% <ø> (?)
mysql 82.02% <ø> (+0.06%) ⬆️
postgres 82.03% <ø> (+0.06%) ⬆️
presto 81.91% <ø> (?)
python 82.53% <ø> (+0.47%) ⬆️
sqlite 81.71% <ø> (+0.07%) ⬆️

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

Impacted Files Coverage Δ
superset/models/core.py 90.00% <ø> (+0.73%) ⬆️
superset/views/api.py 67.18% <0.00%> (-4.25%) ⬇️
superset/commands/utils.py 97.05% <0.00%> (-2.95%) ⬇️
superset/charts/filters.py 94.59% <0.00%> (-1.84%) ⬇️
superset/dashboards/filters.py 94.91% <0.00%> (-1.09%) ⬇️
superset/dashboards/api.py 92.15% <0.00%> (-0.89%) ⬇️
superset/charts/schemas.py 99.32% <0.00%> (-0.68%) ⬇️
superset/charts/post_processing.py 67.20% <0.00%> (-0.28%) ⬇️
superset/cli.py 54.82% <0.00%> (-0.11%) ⬇️
superset/viz.py 58.05% <0.00%> (-0.07%) ⬇️
... and 53 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 8e1619b...2cc9d3a. Read the comment docs.

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.

LGTM

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Sorry, I completely missed this when @junlincc tagged me!

There's a few more things that we need to test before merging this. Exports are now created with an additional field, and your test captures that. But we also need to test that:

  • Can these files be imported correctly? Is the new field used when the database is imported, or is it ignored?
  • Can old exports, without the field, be imported correctly? For old exports it's fine to assume that impersonate_user is False if it's not present, since that's the default. But they should be imported without errors.

@itay
Copy link
Author

itay commented Nov 29, 2021

@betodealmeida thanks for the feedback. The requirements for getting the change in are getting bigger than I have time to put in at the moment - I originally needed this change back in May and have a mini-fork of Superset with just this change, and wanted to contribute it upstream. However, given 6 months have passed, I don't quite have the time to understand the test structure and add the changes right now.

I'm happy if someone else wants to take over this change, or I can try and add the tests as I get some time to do it, but it likely won't be soon.

@betodealmeida
Copy link
Member

@betodealmeida thanks for the feedback. The requirements for getting the change in are getting bigger than I have time to put in at the moment - I originally needed this change back in May and have a mini-fork of Superset with just this change, and wanted to contribute it upstream. However, given 6 months have passed, I don't quite have the time to understand the test structure and add the changes right now.

I'm happy if someone else wants to take over this change, or I can try and add the tests as I get some time to do it, but it likely won't be soon.

I totally understand, and I know how this is frustrating, so my apologies for the delay. Either me or @villebro can take a stab at the tests.

@itay
Copy link
Author

itay commented Nov 29, 2021

No problem - open source maintenance is hard especially for a project as successful as Superset, so I know how difficult it can be to get to the PRs, and I appreciate the response and engagement from the team.

@villebro
Copy link
Member

I'm happy to push a few tests to this PR if needed! Again, thanks so much for you patience and understanding!

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 16, 2022
@stale stale bot closed this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants