You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mcdogg17 (via GitHub)" <gi...@apache.org> on 2025/06/11 09:51:40 UTC
[PR] fix(database): remove database [superset]
mcdogg17 opened a new pull request, #33741:
URL: https://github.com/apache/superset/pull/33741
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
Automatically delete related PVMs when removing database objects
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Previously, deleting database objects could fail due to existing relations with PermissionViewModel (PVM) entries, which caused integrity errors and prevented cleanup.
This PR introduces automatic deletion of all related PVMs during the removal of associated database objects to ensure proper cascading behavior
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(database): remove database [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #33741: fix(database): remove database
URL: https://github.com/apache/superset/pull/33741
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(database): remove database [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #33741:
URL: https://github.com/apache/superset/pull/33741#issuecomment-4255946078
Closing due to inactivity, but feel free to reopen if/when the branch is brought up to speed!
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(database): remove database [superset]
Posted by "mcdogg17 (via GitHub)" <gi...@apache.org>.
mcdogg17 commented on PR #33741:
URL: https://github.com/apache/superset/pull/33741#issuecomment-2962007910
@supersetbot orglabel
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(database): remove database [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #33741:
URL: https://github.com/apache/superset/pull/33741#discussion_r2139721180
##########
superset/security/manager.py:
##########
@@ -1957,8 +1957,10 @@ def _delete_pvm_on_sqla_event( # pylint: disable=too-many-arguments
return
# Delete Any Role to PVM association
connection.execute(
- assoc_permissionview_role.delete().where(
- assoc_permissionview_role.c.permission_view_id == pvm.id
+ assoc_permissionview_role.c.permission_view_id.in_(
+ select(permission_view_menu_table.c.id).where(
+ permission_view_menu_table.c.view_menu_id == pvm.view_menu_id
+ )
)
)
Review Comment:
### Missing DELETE Clause in Role Association Deletion <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The query attempts to delete role associations but lacks a DELETE clause in the SQLAlchemy statement, which would prevent the actual deletion from occurring.
###### Why this matters
Without the DELETE clause, the query will only select the records but not delete them, leaving orphaned permission associations in the database that should have been removed.
###### Suggested change ∙ *Feature Preview*
Add the DELETE clause to properly delete the role associations:
```python
connection.execute(
assoc_permissionview_role.delete().where(
assoc_permissionview_role.c.permission_view_id.in_(
select(permission_view_menu_table.c.id).where(
permission_view_menu_table.c.view_menu_id == pvm.view_menu_id
)
)
)
)
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b7d77952-25a3-4538-83bd-f6f9948849c6/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b7d77952-25a3-4538-83bd-f6f9948849c6?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b7d77952-25a3-4538-83bd-f6f9948849c6?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b7d77952-25a3-4538-83bd-f6f9948849c6?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b7d77952-25a3-4538-83bd-f6f9948849c6)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:a20d1969-68e3-4cbc-827b-7923b37196e2 -->
[](a20d1969-68e3-4cbc-827b-7923b37196e2)
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(database): remove database [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #33741:
URL: https://github.com/apache/superset/pull/33741#issuecomment-3644018729
Hi @mcdogg17 👋
This PR has been inactive for about 6 months and has failing CI tests (mysql, postgres, sqlite, unit-tests). Converting to draft until the test failures are resolved.
When you have time, please investigate and fix the failing tests. If you need help understanding the failures, feel free to ask!
If you're no longer able to work on this, let us know and we can close it or have someone else pick it up.
Thanks for your contribution!
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org