You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Vitor-Avila (via GitHub)" <gi...@apache.org> on 2025/01/30 15:28:52 UTC
[PR] chore: Skip the creation of secondary perms during catalog migrations [superset]
Vitor-Avila opened a new pull request, #32043:
URL: https://github.com/apache/superset/pull/32043
### SUMMARY
The migrations to add catalog permissions can take considerably long, as it would get all catalogs exposed to the credentials, then get all schemas for each of these catalogs and create these permissions accordingly.
This requires longer migrations that typically run with downtime.
This PR adds a flag to the `config` that allows to skip these permissions, as these can be created later once the app is up by just editing the DB connection.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No UI changes.
### TESTING INSTRUCTIONS
Unit tests added.
### 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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #32043:
URL: https://github.com/apache/superset/pull/32043#discussion_r1935837916
##########
superset/config.py:
##########
@@ -1905,6 +1905,15 @@ class ExtraDynamicQueryFilters(TypedDict, total=False):
EXTRA_DYNAMIC_QUERY_FILTERS: ExtraDynamicQueryFilters = {}
+# The migrations that add catalog permissions might take a considerably long time
+# to execute as it has to create permissions to all schemas and catalogs from all
+# other catalogs accessible by the credentials. This flag allows to skip the
+# creation of these secondary perms, and focus only on permissions for the default
+# catalog. These secondary permissions can be created later by editing the DB
+# connection via the UI (without downtime).
+CATALOGS_SIMPLIFIED_MIGRATION: bool = False
Review Comment:
### Default value of CATALOGS_SIMPLIFIED_MIGRATION negates intended performance improvement <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The new flag is set to False by default, which does not align with the developer's intent to help reduce execution time of catalog migrations.
###### Why this matters
Users won't get the performance benefits of skipping secondary permissions during catalog migrations unless they explicitly set the flag to True in their configuration.
###### Suggested change ∙ *Feature Preview*
The default value should match the developer's intent for improved performance:
```python
CATALOGS_SIMPLIFIED_MIGRATION: bool = True
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bf955330-c2fe-4db3-aa70-b3fada44c887?suggestedFixEnabled=true)
💬 Chat with Korbit by mentioning @korbit-ai.
</sub>
<!--- korbi internal id:453b8a76-cd1a-4cb9-a488-7ebcabb34858 -->
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on PR #32043:
URL: https://github.com/apache/superset/pull/32043#issuecomment-2624985888
> @Vitor-Avila if these migrations are optional, why are they executed by default in the first place? Isn't better to just remove them from the upgrade script instead of create a new feature flag? If they are not optional, what happens when they are skipped because of the feature flag?
@michael-s-molina we want to apply these migrations as soon as possible, because without them the data in non-default catalogs is vulnerable — users with access to schema `foo` in the default catalog will be able to access schemas with the same name in the non-default catalogs, which is probably not what the administrator wants.
In most cases the migration is quick and painless, but of course there are people with huge databases where this can take considerable time. So this is a compromise between security and performance.
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on PR #32043:
URL: https://github.com/apache/superset/pull/32043#issuecomment-2624981064
> @Vitor-Avila if these migrations are optional, why are they executed by default in the first place? Isn't better to just remove them from the upgrade script instead of create a new feature flag? If they are not optional, what happens when they are skipped because of the feature flag?
Hey @michael-s-molina,
Before catalogs, to query something from another database in the DB instance/host users would have to do it via a virtual dataset using `select * from <other_catalog>.<schema>.<table>`. These "secondary permissions" are created so that after the migration, limited users need access on these other catalogs in order to query them in SQL Lab.
For existing datasets and charts, they'll all be associated with the `default_catalog` in their permission setting (even if they're querying other catalog) as we won't parse the query to determine (the same happens today if you create a dataset with `schema_a` selected in the dropdown and use `select * from schema_b.table`).
That said, ideally creating these permissions during the migration is a good thing, but we've seen cases where this process takes too long, and that causes a very long migration/downtime. For example, there used to be a Postgres Cloud service named `ElephantSQL`, and your credentials would be able to list all DBs in the instance (even though you actually don't have access to these other DBs).
These permissions are going to be added by the time you edit the DB configuration (either to enable the ability to change catalogs, or any other change actually).
I thought about adding it as a config because if you're able to run the migration with the config disabled, then it's great! All perms created. But if you start facing issues, a long downtime, then enabling the setting might be ideal.
Let me know your thoughts.
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #32043:
URL: https://github.com/apache/superset/pull/32043#issuecomment-2624945541
> This flag allows to skip the
> creation of these secondary perms, and focus only on permissions for the default
> catalog. These secondary permissions can be created later by editing the DB
> connection via the UI (without downtime).
@Vitor-Avila if these migrations are optional, why do they are executed by default in the first place? Isn't better to just remove them of upgrading script than creating a feature flag? If they are not optional, what happens when they are skipped because of the feature flag?
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila merged PR #32043:
URL: https://github.com/apache/superset/pull/32043
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on PR #32043:
URL: https://github.com/apache/superset/pull/32043#issuecomment-2624843591
/korbit-review
--
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] chore: Skip the creation of secondary perms during catalog migrations [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #32043:
URL: https://github.com/apache/superset/pull/32043#issuecomment-2625108031
Got it. Thanks for the additional context @Vitor-Avila @betodealmeida!
--
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