You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/06/01 23:45:41 UTC
[PR] feat(sqllab): accept results key via POST body [superset]
rusackas opened a new pull request, #40630:
URL: https://github.com/apache/superset/pull/40630
### SUMMARY
The SQL Lab results endpoint (`/api/v1/sqllab/results/`) previously accepted the cached results key — and optional row limit — only as query-string parameters on a `GET` request, which means the key ends up in URLs.
This PR adds a `POST` variant of the same endpoint that reads the parameters from a JSON request body instead:
```json
{ "key": "<results-key>", "rows": 100 }
```
- A new `post_results` handler accepts `{ "key": string, "rows": number? }` (rows optional), validated by a new `SqlLabResultsSchema` marshmallow schema.
- Both the existing `GET` and the new `POST` share a single `_get_results_response` helper, so behavior is identical. The `POST` method is bound to the same `can_get_results` permission via `@permission_name("get_results")`, so no new permission/grant is introduced.
- The **existing `GET` endpoint is retained unchanged** for backward compatibility.
- The frontend `fetchQueryResults` action now issues a `POST` with the key/rows in `jsonPayload`, so the key is no longer placed in the query string. Response handling is unchanged.
No `UPDATING.md` entry is added: the change is purely additive (a new optional `POST` method; the `GET` is unchanged) and is not backwards-incompatible, which is what `UPDATING.md` documents.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — no UI change.
### TESTING INSTRUCTIONS
- Backend: `pytest tests/integration_tests/sql_lab/api_tests.py::TestSqlLabApi::test_post_results_matches_get tests/integration_tests/sql_lab/api_tests.py::TestSqlLabApi::test_post_results_requires_key`
- `test_post_results_matches_get` asserts the `POST` returns the same payload as the `GET`, honors the optional `rows` limit, and that the `GET` still works.
- `test_post_results_requires_key` asserts a `POST` with no key returns `400`.
- Frontend: `cd superset-frontend && npx jest src/SqlLab/actions/sqlLab.test.ts`
- New test asserts `fetchQueryResults` issues a `POST` with the key in the request body and not in the URL.
- Manual: run a query in SQL Lab and confirm results still load; the network request to `/api/v1/sqllab/results/` is a `POST` whose body carries the key.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #40630: feat(sqllab): accept results key via POST body
URL: https://github.com/apache/superset/pull/40630
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40630:
URL: https://github.com/apache/superset/pull/40630#issuecomment-4597409884
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | eec8dbce475d3d3d55309775f1638f02d9315dba |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a1e19a524df660008f1e525 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40630--superset-docs-preview.netlify.app](https://deploy-preview-40630--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpBCoAgEADAv-w5SSOl-kHP0FwpstbUIIn-nrc5zAsh0hEyTAANmKjPZa1229Omy3ttWMR0-5zYjoUFSpkZsqVei8FTmW3dSgsUo5Zdb51SnPPBCZSdhO8H) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-40630--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #40630:
URL: https://github.com/apache/superset/pull/40630#discussion_r3337831329
##########
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:
`post_results` is logged as `...get_results` in the event logger action, which makes audit/event logs ambiguous and misleading (GET vs POST are indistinguishable). This should use the actual handler name (or a distinct action) so consumers can tell which route/method was invoked.
##########
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:
`rows` is described as a maximum row limit, but the schema currently allows negative (and 0) values. Negative values lead to surprising slicing semantics in `apply_display_max_row_configuration_if_require` (e.g. `data[: -1]`) and 0 is silently ignored because `if self._rows:` is falsy. Add a validation constraint so only positive integers are accepted.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40630:
URL: https://github.com/apache/superset/pull/40630#issuecomment-4598684405
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40630:
URL: https://github.com/apache/superset/pull/40630#issuecomment-4597407796
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40630?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `66.66667%` with `6 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 55.28%. Comparing base ([`87be424`](https://app.codecov.io/gh/apache/superset/commit/87be424f9c4f1841d7185047cab4aaf9450265ac?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`eec8dbc`](https://app.codecov.io/gh/apache/superset/commit/eec8dbce475d3d3d55309775f1638f02d9315dba?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 41 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/40630?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/sqllab/api.py](https://app.codecov.io/gh/apache/superset/pull/40630?src=pr&el=tree&filepath=superset%2Fsqllab%2Fapi.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvc3FsbGFiL2FwaS5weQ==) | 60.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40630?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (87be424) and HEAD (eec8dbc). Click for more details.
>
> <details><summary>HEAD has 89 uploads less than BASE</summary>
>
>| Flag | BASE (87be424) | HEAD (eec8dbc) |
>|------|------|------|
>|python|83|1|
>|presto|8|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #40630 +/- ##
==========================================
- Coverage 64.02% 55.28% -8.74%
==========================================
Files 2648 2653 +5
Lines 142275 142693 +418
Branches 32695 32773 +78
==========================================
- Hits 91088 78891 -12197
- Misses 49629 63113 +13484
+ Partials 1558 689 -869
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.37% <66.66%> (-0.06%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.37% <66.66%> (-18.75%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/40630/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/40630?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(sqllab): accept results key via POST body [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40630:
URL: https://github.com/apache/superset/pull/40630#issuecomment-4597390721
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org