dpgaspar commented on a change in pull request #9427: feat: Add post processing 
to QueryObject
URL: 
https://github.com/apache/incubator-superset/pull/9427#discussion_r405374109
 
 

 ##########
 File path: superset/common/query_object.py
 ##########
 @@ -138,9 +145,36 @@ def cache_key(self, **extra: Any) -> str:
         if self.time_range:
             cache_dict["time_range"] = self.time_range
         json_data = self.json_dumps(cache_dict, sort_keys=True)
+        if self.post_processing:
+            cache_dict["post_processing"] = self.post_processing
         return hashlib.md5(json_data.encode("utf-8")).hexdigest()
 
     def json_dumps(self, obj: Any, sort_keys: bool = False) -> str:
         return json.dumps(
             obj, default=utils.json_int_dttm_ser, ignore_nan=True, 
sort_keys=sort_keys
         )
+
+    def exec_post_processing(self, df: DataFrame) -> DataFrame:
+        """
+        Perform post processing operations on DataFrame.
+
+        :param df: DataFrame returned from database model.
+        :return: new DataFrame to which all post processing operations have 
been
+                 applied
+        """
+        for post_process in self.post_processing:
+            operation = post_process.get("operation")
 
 Review comment:
   A deeper data structure validation should be done on the API side first, but 
I guess it makes sense here also

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to