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: None dataset and schema permissions #20108

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented May 18, 2022

SUMMARY

Currently load examples creates duplicate schema and dataset permissions like:

[None].[covid_vaccines](id:19)
[examples].[covid_vaccines](id:19)
[None].[channel_members](id:22)
[examples].[channel_members](id:22)
...

This is due to the fact that a SqlaTable can be created without an associated database triggering SQLAlchemy listen set_perm with a None database.
This is a simple/patch fix, we should revisit the entire logic around creating permissions for datasets, databases and schemas since it's possible to have orphaned permissions also when (for example) a database name is changed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #20108 (7bab7f5) into master (660af40) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #20108      +/-   ##
==========================================
- Coverage   66.47%   66.46%   -0.01%     
==========================================
  Files        1721     1721              
  Lines       64477    64485       +8     
  Branches     6795     6795              
==========================================
+ Hits        42858    42862       +4     
- Misses      19891    19895       +4     
  Partials     1728     1728              
Flag Coverage Δ
hive 53.70% <69.23%> (-0.01%) ⬇️
mysql 82.14% <100.00%> (+<0.01%) ⬆️
postgres 82.19% <100.00%> (-0.01%) ⬇️
presto 53.56% <69.23%> (-0.01%) ⬇️
python 82.61% <100.00%> (-0.01%) ⬇️
sqlite 81.94% <100.00%> (+<0.01%) ⬆️
unit 49.42% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/connectors/sqla/models.py 89.59% <100.00%> (+0.01%) ⬆️
superset/exceptions.py 90.90% <100.00%> (+0.08%) ⬆️
superset/security/manager.py 95.33% <100.00%> (+0.04%) ⬆️
superset/reports/commands/log_prune.py 85.71% <0.00%> (-3.58%) ⬇️
superset/commands/importers/v1/utils.py 92.20% <0.00%> (-1.30%) ⬇️
superset/common/query_object.py 94.73% <0.00%> (-0.53%) ⬇️
superset/reports/commands/execute.py 91.24% <0.00%> (-0.37%) ⬇️

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 660af40...7bab7f5. Read the comment docs.

@dpgaspar dpgaspar requested a review from a team as a code owner May 18, 2022 16:58
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 18, 2022
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, this is a really welcome improvement!

@dpgaspar dpgaspar merged commit b9a98aa into apache:master May 20, 2022
@dpgaspar dpgaspar deleted the danielgaspar/sc-47000/none-database-incorrectly-displayed-on-the branch May 20, 2022 08:40
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
* fix: None dataset and schema permissions

* fix pylint

* add migration and test

* fix migration
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants