villebro commented on code in PR #23905:
URL: https://github.com/apache/superset/pull/23905#discussion_r1182884456


##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -68,22 +69,50 @@ def _migrate(self) -> None:
 
             if key in self.rename_keys:
                 rv_data[self.rename_keys[key]] = value
+                continue
 
             if key in self.remove_keys:
                 continue
 
             rv_data[key] = value
 
+        if is_feature_enabled("GENERIC_CHART_AXES"):
+            self._migrate_temporal_filter(rv_data)
+
         self.data = rv_data
 
     def _post_action(self) -> None:
-        """some actions after migrate"""
+        """Some actions after migrate"""
+
+    def _migrate_temporal_filter(self, rv_data: Dict[str, Any]) -> None:
+        """Adds a temporal filter."""
+        granularity_sqla = rv_data.pop("granularity_sqla", None)
+        time_range = rv_data.pop("time_range", conf.get("DEFAULT_TIME_FILTER"))

Review Comment:
   I believe there's the risk that the property is defined with a `None` value, 
in which case the default value wouldn't kick in (I've learned to be sceptical 
about form data quality 😄 ). So I think it may be a good idea to do
   ```suggestion
           time_range = rv_data.pop("time_range", None) or 
conf.get("DEFAULT_TIME_FILTER")
   ```



-- 
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-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to