villebro commented on a change in pull request #8626: slightly decouple
sql_json, queries, and results http endpoints from …
URL:
https://github.com/apache/incubator-superset/pull/8626#discussion_r349287472
##########
File path: superset/views/core.py
##########
@@ -2722,33 +2725,37 @@ def _sql_json_sync(
@expose("/sql_json/", methods=["POST"])
@event_logger.log_this
def sql_json(self):
+ query_params = request.json
+ return self.sql_json_exec(query_params)
+
+ def sql_json_exec(self, query_params):
"""Runs arbitrary sql and returns data as json"""
# Collect Values
- database_id: int = request.json.get("database_id")
- schema: str = request.json.get("schema")
- sql: str = request.json.get("sql")
+ database_id: int = query_params.get("database_id")
+ schema: str = query_params.get("schema")
+ sql: str = query_params.get("sql")
try:
template_params: dict = json.loads(
- request.json.get("templateParams") or "{}"
+ query_params.get("templateParams") or "{}"
)
except json.decoder.JSONDecodeError:
logging.warning(
- f"Invalid template parameter
{request.json.get('templateParams')}"
+ f"Invalid template parameter
{query_params.get('templateParams')}"
" specified. Defaulting to empty dict"
)
template_params = {}
- limit = request.json.get("queryLimit") or app.config["SQL_MAX_ROW"]
- async_flag: bool = request.json.get("runAsync")
+ limit = query_params.get("queryLimit") or app.config["SQL_MAX_ROW"]
Review comment:
`limit: int` I believe
----------------------------------------------------------------
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]