cccs-jc commented on a change in pull request #14765:
URL: https://github.com/apache/superset/pull/14765#discussion_r640881451
##########
File path: superset/views/utils.py
##########
@@ -196,6 +199,26 @@ def get_form_data( # pylint: disable=too-many-locals
return form_data, slc
+def add_sqllab_custom_filters(form_data: Dict[Any, Any]) -> Any:
+ """
+ SQLLab can include a "filters" attribute in the templateParams.
+ The filters attribute is a list of filters to include in the
+ request. Useful for testing templates in SQLLab.
+ """
+ try:
+ data = json.loads(request.data)
+ if isinstance(data, dict):
+ params_str = data.get("templateParams")
+ if isinstance(params_str, str):
+ params = json.loads(params_str)
+ if isinstance(params, dict):
+ filters = params.get("filters")
+ if filters:
+ form_data.update({"filters": filters})
+ except (TypeError, json.JSONDecodeError):
+ data = {}
Review comment:
Sure we can make it a reserve keyword. How would that be done?
I'll need a bit of details. "Not persist that in virtual dataset metadata" ?
--
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]