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:
amaannawab923
2025-05-09 22:57:31 +05:30
committed by GitHub
parent 9e38a0cc29
commit 22475e787e
23 changed files with 934 additions and 77 deletions

View File

@@ -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