rusackas commented on code in PR #42929:
URL: https://github.com/apache/superset/pull/42929#discussion_r3763243807


##########
superset/commands/dataset/update.py:
##########
@@ -183,21 +192,33 @@ def _validate_dataset_source(self, exceptions: 
list[ValidationError]) -> None:
         ):
             exceptions.append(DatasetExistsValidationError(table))
 
-        self._validate_sql_access(db, catalog, schema, exceptions)
+        # Repointing a physical dataset (or converting a virtual dataset to a
+        # physical one) runs the same data-access check as the create path.
+        sql = self._properties.get("sql", self._model.sql)
+        if not sql and (
+            source_changed or ("sql" in self._properties and self._model.sql)
+        ):
+            try:
+                security_manager.raise_for_access(database=db, table=table)
+            except SupersetSecurityException as ex:
+                
exceptions.append(DatasetDataAccessIsNotAllowed(ex.error.message))
+

Review Comment:
   Good catch. Removed the redundant checks: the physical-repoint table check 
now only runs when the database itself did not change (the repoint check above 
already covers that pair), and the SQL-access re-check no longer fires on a 
bare `database_changed` without an actual SQL change.



-- 
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]

Reply via email to