xtinec commented on a change in pull request #6220: [SIP-5] Open a new 
/api/v1/query endpoint that takes query_obj
URL: 
https://github.com/apache/incubator-superset/pull/6220#discussion_r229541843
 
 

 ##########
 File path: superset/models/core.py
 ##########
 @@ -87,6 +87,37 @@ def copy_dashboard(mapper, connection, target):
     session.commit()
 
 
+def query_obj_backfill(form_data, datasource_id=None, datasource_type=None):
+    # Backfill query_obj. This will be generated on the client in the future.
+    # Note we unpack the metrics on the viz here so we can create the metrics
+    # dictionary during viz initialization without leveraging form_data.
+    #
+    # TODO: Note structure of the backfilled query_obj is temporary. It will be
+    # restructured as we build out the query object on the client side.
+    # The fields included are necessary to load a table viz without form_data
+    query_obj = {
+        'viz_type': form_data.get('viz_type', 'table'),
+        'time_range': form_data.get('time_range'),
+        'include_time': form_data.get('include_time'),
+        'token': form_data.get('token'),
 
 Review comment:
   This is a port of the token generation code from 
   
https://github.com/apache/incubator-superset/blob/master/superset/viz.py#L76-L77
   
   It is being used in generating the `json_data` property for a viz
   
https://github.com/apache/incubator-superset/blob/master/superset/viz.py#L469-L490
   
   The fields used to calculate cache keys looks to be something else entirely
   
https://github.com/apache/incubator-superset/blob/master/superset/viz.py#L338-L360
   
   No idea what this token field is intended for. Any thoughts?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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