New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for query offset #10010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple of comments
superset/charts/schemas.py
Outdated
@@ -664,6 +664,7 @@ class ChartDataQueryObjectSchema(Schema): | |||
row_limit = fields.Integer( | |||
description='Maximum row count. Default: `config["ROW_LIMIT"]`', | |||
) | |||
row_offset = fields.Integer(description="Number of rows to skip. Default: `0`",) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider enforcing row_offset
is >0
validate=[Range(min=0, error=_("row_offset must be greater than 0"))])
self.login(username="admin") | ||
table = self.get_table_by_name("birth_names") | ||
request_payload = get_query_context(table.name, table.id, table.type) | ||
request_payload["queries"][0]["row_limit"] = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to a couple of simple tests with invalid row_limit
and row_offset
. negative values, bigger then SAMPLES_ROW_LIMIT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added schema validation tests (tests/chart/schema_tests.py
) for validation of row_limit
and row_offset
and e2e tests (tests/chart/api_tests.py
) to ensure regular and sample row limits produce correct row counts.
Codecov Report
@@ Coverage Diff @@
## master #10010 +/- ##
==========================================
+ Coverage 65.59% 70.41% +4.82%
==========================================
Files 585 585
Lines 31046 31056 +10
Branches 3277 3277
==========================================
+ Hits 20364 21868 +1504
+ Misses 10501 9077 -1424
+ Partials 181 111 -70
Continue to review full report at Codecov.
|
* feat: add support for query offset * Address comments and add new tests
SUMMARY
In order to support server side pagination, support for
row_offset
needs to be added to to complementrow_limit
inQueryObject
.TEST PLAN
CI + new tests
ADDITIONAL INFORMATION