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/08/02 09:41:50 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #16017: fix(native-filters): add support for versioned import/export

zhaoyongjie commented on a change in pull request #16017:
URL: https://github.com/apache/superset/pull/16017#discussion_r680826409



##########
File path: superset/dashboards/commands/export.py
##########
@@ -126,6 +128,16 @@ def _export(model: Dashboard) -> Iterator[Tuple[str, str]]:
                     logger.info("Unable to decode `%s` field: %s", key, value)
                     payload[new_name] = {}
 
+        # Extract all native filter datasets and replace native
+        # filter dataset references with uuid
+        for native_filter in payload["metadata"].get("native_filter_configuration", []):
+            for target in native_filter.get("targets", []):
+                dataset_id = target.pop("datasetId", None)
+                if dataset_id is not None:
+                    dataset = DatasetDAO.find_by_id(dataset_id)

Review comment:
       and change DatasetDAO.find_by_id argument type hint.
   
   ```suggestion
           for native_filter in payload.get("metadata", {}).get("native_filter_configuration", []):
               for target in native_filter.get("targets", []):
                   dataset_id = target.pop("datasetId", None)
                   dataset = DatasetDAO.find_by_id(dataset_id)
                   if dataset:
   ```




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