From 6f6f7af0c3b50b9674085c280155e13c40aa51f9 Mon Sep 17 00:00:00 2001 From: Bogdan Kyryliuk Date: Fri, 3 Feb 2017 15:16:06 -0800 Subject: [PATCH] Increase query limit to 1M, add separate display limit. --- superset/config.py | 3 ++- superset/views.py | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/superset/config.py b/superset/config.py index d35d9e3a2b25f..71036d69278b9 100644 --- a/superset/config.py +++ b/superset/config.py @@ -203,7 +203,8 @@ MAPBOX_API_KEY = "" # Maximum number of rows returned in the SQL editor -SQL_MAX_ROW = 1000 +SQL_MAX_ROW = 1000000 +DISPLAY_SQL_MAX_ROW = 1000 # If defined, shows this text in an alert-warning box in the navbar # one example use case may be "STAGING" to make it clear that this is diff --git a/superset/views.py b/superset/views.py index d4132f645bab4..18150c6bf04c2 100755 --- a/superset/views.py +++ b/superset/views.py @@ -2481,11 +2481,14 @@ def results(self, key): if rejected_tables: return json_error_response(get_datasource_access_error_msg( '{}'.format(rejected_tables))) - + payload = zlib.decompress(blob) + display_limit = app.config.get('DISPLAY_SQL_MAX_ROW', None) + if display_limit: + payload_json = json.loads(payload) + payload_json['data'] = payload_json['data'][:display_limit] return Response( - zlib.decompress(blob), - status=200, - mimetype="application/json") + json.dumps(payload_json, default=utils.json_iso_dttm_ser), + status=200, mimetype="application/json") else: return Response( json.dumps({