mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(Table Chart): Row limit Increase , Backend Sorting , Backend Search , Excel/CSV Improvements (#33357)
Co-authored-by: Amaan Nawab <nelsondrew07@gmail.com>
This commit is contained in:
@@ -1741,24 +1741,30 @@ def parse_boolean_string(bool_str: str | None) -> bool:
|
||||
|
||||
def apply_max_row_limit(
|
||||
limit: int,
|
||||
max_limit: int | None = None,
|
||||
server_pagination: bool | None = None,
|
||||
) -> int:
|
||||
"""
|
||||
Override row limit if max global limit is defined
|
||||
Override row limit based on server pagination setting
|
||||
|
||||
:param limit: requested row limit
|
||||
:param max_limit: Maximum allowed row limit
|
||||
:param server_pagination: whether server-side pagination
|
||||
is enabled, defaults to None
|
||||
:return: Capped row limit
|
||||
|
||||
>>> apply_max_row_limit(100000, 10)
|
||||
10
|
||||
>>> apply_max_row_limit(10, 100000)
|
||||
10
|
||||
>>> apply_max_row_limit(0, 10000)
|
||||
10000
|
||||
>>> apply_max_row_limit(600000, server_pagination=True) # Server pagination
|
||||
500000
|
||||
>>> apply_max_row_limit(600000, server_pagination=False) # No pagination
|
||||
50000
|
||||
>>> apply_max_row_limit(5000) # No server_pagination specified
|
||||
5000
|
||||
>>> apply_max_row_limit(0) # Zero returns default max limit
|
||||
50000
|
||||
"""
|
||||
if max_limit is None:
|
||||
max_limit = current_app.config["SQL_MAX_ROW"]
|
||||
max_limit = (
|
||||
current_app.config["TABLE_VIZ_MAX_ROW_SERVER"]
|
||||
if server_pagination
|
||||
else current_app.config["SQL_MAX_ROW"]
|
||||
)
|
||||
if limit != 0:
|
||||
return min(max_limit, limit)
|
||||
return max_limit
|
||||
|
||||
Reference in New Issue
Block a user