eschutho commented on code in PR #21161:
URL: https://github.com/apache/superset/pull/21161#discussion_r958777299
##########
superset/databases/commands/update.py:
##########
@@ -86,6 +92,33 @@ def run(self) -> Model:
raise DatabaseUpdateFailedError() from ex
return database
+ @staticmethod
+ def _propagate_schema_permissions(
+ old_view_menu_name: str, new_view_menu_name: str
+ ) -> None:
+ from superset.connectors.sqla.models import ( # pylint:
disable=import-outside-toplevel
+ SqlaTable,
+ )
+ from superset.models.slice import ( # pylint:
disable=import-outside-toplevel
+ Slice,
+ )
+
+ # Update schema_perm on all datasets
+ datasets = (
+ db.session.query(SqlaTable)
+ .filter(SqlaTable.schema_perm == old_view_menu_name)
+ .all()
+ )
+ for dataset in datasets:
+ dataset.schema_perm = new_view_menu_name
+ charts = db.session.query(Slice).filter(
+ Slice.datasource_type == "table",
Review Comment:
Just noticed that you're using the enum below. 👍
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]