rusackas commented on code in PR #40630:
URL: https://github.com/apache/superset/pull/40630#discussion_r3338042381
##########
superset/sqllab/api.py:
##########
@@ -493,8 +496,62 @@ def get_results(self, **kwargs: Any) -> FlaskResponse:
$ref: '#/components/responses/500'
"""
params = kwargs["rison"]
- key = params.get("key")
- rows = params.get("rows")
+ return self._get_results_response(
+ key=params.get("key"), rows=params.get("rows")
+ )
+
+ @expose("/results/", methods=("POST",))
+ @protect()
+ @permission_name("get_results")
+ @statsd_metrics
+ @requires_json
+ @event_logger.log_this_with_context(
+ action=lambda self, *args, **kwargs:
f"{self.__class__.__name__}.get_results",
+ log_to_statsd=False,
Review Comment:
Fixed — the handler was using as its event logger action string. Changed
to in the latest commit so the two endpoints are distinguishable in audit logs.
##########
superset/sqllab/schemas.py:
##########
@@ -27,6 +27,18 @@
}
+class SqlLabResultsSchema(Schema):
+ key = fields.String(
+ required=True,
+ metadata={"description": "The results key of the cached query
results"},
+ )
+ rows = fields.Integer(
+ required=False,
+ allow_none=True,
+ metadata={"description": "The maximum number of rows to return"},
+ )
Review Comment:
Good catch. Added `validate=validate.Range(min=1)` to the `rows` field in
`SqlLabResultsSchema` — negative values would cause silent `data[:-1]` slicing
and zero is already ignored by the existing `if self._rows:` guard, so only
positive integers are meaningful.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]