diff --git a/superset/config.py b/superset/config.py index d35d9e3a2b25..71036d69278b 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 d4132f645bab..18150c6bf04c 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({