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/09/03 18:09:21 UTC

Re: [PR] feat: allow create metric and add to folder in single request [superset]

Vitor-Avila commented on code in PR #34993:
URL: https://github.com/apache/superset/pull/34993#discussion_r2319804638


##########
superset/commands/dataset/update.py:
##########
@@ -257,6 +265,16 @@ def validate_folders(  # noqa: C901
         *[column.uuid for column in columns],
     }
 
+    # Add UUIDs from new metrics and columns in the payload
+    if new_metrics:
+        existing.update(
+            metric.get("uuid") for metric in new_metrics if metric.get("uuid")
+        )
+    if new_columns:
+        existing.update(
+            column.get("uuid") for column in new_columns if column.get("uuid")
+        )

Review Comment:
   Hmm I think we need a different approach here. In case the update payload includes `columns` or `metrics`, they would replace the existing columns or metrics in the DB. So instead of appending the new `uuid` values to `existing`, we should consider only the new ones if present.
   
   Might be easier to keep `validate_folders` as is, but then when calling it pass `self._properties.get("metrics", self._model.metrics)` and `self._properties.get("columns", self._model.columns)`. What do you think?



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