You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/11/10 01:10:50 UTC

[GitHub] [superset] betodealmeida commented on a change in pull request #17348: fix: Users being able to update datasets across DBs

betodealmeida commented on a change in pull request #17348:
URL: https://github.com/apache/superset/pull/17348#discussion_r746169917



##########
File path: superset/datasets/dao.py
##########
@@ -85,12 +85,22 @@ def validate_table_exists(
             return False
 
     @staticmethod
-    def validate_uniqueness(database_id: int, schema: Optional[str], name: str) -> bool:
+    def validate_uniqueness(
+        database_id: int,
+        schema: Optional[str],
+        name: str,
+        dataset_id: Optional[int] = None,
+    ) -> bool:
         dataset_query = db.session.query(SqlaTable).filter(
             SqlaTable.table_name == name,
             SqlaTable.schema == schema,
             SqlaTable.database_id == database_id,
         )
+
+        if dataset_id:
+            # Validate that the dataset is not referencing itself

Review comment:
       Nit, we actually validate if the dataset is referencing itself — not that we return a `not` in line 104, ie, the inverse of the query.
   
   ```suggestion
               # make sure the dataset found is different from the target (if any)
   ```




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