mistercrunch 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_r229836118
##########
File path: superset/views/core.py
##########
@@ -1200,17 +1186,30 @@ def annotation_json(self, layer_id):
form_data=form_data,
force=False,
)
- try:
- payload = viz_obj.get_payload()
- except Exception as e:
- logging.exception(e)
- return json_error_response(utils.error_msg_from_exception(e))
- status = 200
- if payload.get('status') == QueryStatus.FAILED:
- status = 400
- return json_success(viz_obj.json_dumps(payload), status=status)
+ payload_json_and_error = viz_obj.get_payload_json_and_error()
+ return self.payload_response(payload_json_and_error)
@log_this
+ @api
+ @handle_superset_exception
+ @has_access_api
+ @expose('/api/v1/query/', methods=['POST'])
Review comment:
Thought some more about this vs the `{ROOT}/api/` folder (more as an app
folder). I feel like to do that well, we'd almost need to go:
```
apps/
main/
api/
common/
```
Refactoring all the common stuff into `common/` would be pretty hard and
would merge conflict brutally over a long period of time...
Personally I think the best is just to add a new `{ROOT}/views/api.py`
----------------------------------------------------------------
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]