durchgedreht opened a new issue #13649:
URL: https://github.com/apache/superset/issues/13649


   I have a chart that has some baked in filters (e.g. "last day"). I' like to 
just overwrite that one filter option and data should be exported in CSV using 
the "explore_json" option. So URL looks like:
   
   ```https://some.domain/superset/explore_json/?csv=true&form_data=XYZ```
   
   I know the slice_id and want to load this directly by addressing it. That 
works fine:
   
    ```json
   {
        "slice_id":123
   }'
   ```
   Of course the JSON is URLencoded and Url looks like:
   ```
   
https://some.domain/superset/explore_json/?csv=true&form_data={%22slice_id%22:123}
   ```
   
   Also handing over the complete config in the form_data param works (here 
pretty printed and unencoded for simplicity):
   
   ```json
   {
     "queryFields": {
       "groupby": "groupby",
       "metrics": "metrics"
     },
     "datasource": "111__table",
     "viz_type": "table",
     "slice_id": 123,
     "url_params": {},
     "time_range_endpoints": [
       "inclusive",
       "exclusive"
     ],
     "granularity_sqla": "mydate",
     "time_grain_sqla": "P1D",
     "time_range": "Last+day",
     "groupby": [
       "aaa",
       "bbb"
     ],
     "metrics": [
       "m1",
       "m2"
   
     ],
     "all_columns": [],
     "percent_metrics": [],
     "order_by_cols": [],
     "row_limit": "1000",
     "include_time": true,
     "order_desc": true,
     "adhoc_filters": [],
     "table_timestamp_format": "%Y-%m-%d",
     "color_pn": true,
     "show_cell_bars": true
   }
   ```
   
   So I wanted to overwrite the date filter:
   
   ```json
   {
     "slice_id":123,
     "time_range":"Last 2 days"
   }
   ```
   With URL:
   ```
   
https://some.domain/superset/explore_json/?csv=true&form_data=%7B%22slice_id%22%3A123%2C%22time_range%22%3A%22Last%202%20days%22%7D
   ```
   
   But I get an error the table does not exist (obviously it tries to read it 
from the JSON and is not using the saved parameters). Is this really intended 
and does not take the 'convention over configuration' principle? In a big slice 
with many fields this can get pretty messy. Also some fields can be left out 
("show_cell_bars"), others [that also don't need to be defined in the UI] seem 
to be mandatory ("time_table_format").
   
   Error:
   ```json
   {
       "errors": [
           {
               "message": "The datasource associated with this chart no longer 
exists",
               "error_type": "FAILED_FETCHING_DATASOURCE_INFO_ERROR",
               "level": "error",
               "extra": null
           }
       ]
   }
   ```
   
   
   
   
   


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



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

Reply via email to