dpgaspar commented on code in PR #20081:
URL: https://github.com/apache/superset/pull/20081#discussion_r929679309
##########
superset/databases/commands/update.py:
##########
@@ -44,18 +44,38 @@ def __init__(self, model_id: int, data: Dict[str, Any]):
def run(self) -> Model:
self.validate()
+ if not self._model:
+ raise DatabaseNotFoundError()
+ old_database_name = self._model.database_name
+
try:
database = DatabaseDAO.update(self._model, self._properties,
commit=False)
database.set_sqlalchemy_uri(database.sqlalchemy_uri)
- security_manager.add_permission_view_menu("database_access",
database.perm)
# adding a new database we always want to force refresh schema list
# TODO Improve this simplistic implementation for catching DB conn
fails
try:
schemas = database.get_all_schema_names()
except Exception as ex:
db.session.rollback()
raise DatabaseConnectionFailedError() from ex
+ # Update database schema permissions
+ new_schemas: List[str] = []
for schema in schemas:
+ old_view_menu_name = security_manager.get_schema_perm(
Review Comment:
Very valid point, I would prefer to place it on the event listener also, but
my decision is that `database.get_all_schema_names()` will query the analytics
DB for all available schemas, so it needs the database to be online, it seems
unexpected to place this operation on a "background" task
--
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]