From 4152bdb5daf49932f4d29f84baea8647e11f4f1d Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Fri, 13 Jul 2018 22:55:23 +0300 Subject: [PATCH 1/5] Fix display limit in sql lab --- superset/sql_lab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/sql_lab.py b/superset/sql_lab.py index 34a9eeb9e3767..1ecf1f5c63fa3 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -129,7 +129,7 @@ def handle_error(msg): # Limit enforced only for retrieving the data, not for the CTA queries. superset_query = SupersetQuery(rendered_query) executed_sql = superset_query.stripped() - SQL_MAX_ROWS = app.config.get('SQL_MAX_ROW') + SQL_MAX_ROWS = app.config.get('DISPLAY_SQL_MAX_ROW') if not superset_query.is_select() and not database.allow_dml: return handle_error( 'Only `SELECT` statements are allowed against this database') From 68f7cf9044572175d87c2691df6a29420f3353d3 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Fri, 13 Jul 2018 23:26:21 +0300 Subject: [PATCH 2/5] Add redundant variable from config.py --- superset/config.py | 1 - 1 file changed, 1 deletion(-) diff --git a/superset/config.py b/superset/config.py index bd02bb4fcd493..29345af546962 100644 --- a/superset/config.py +++ b/superset/config.py @@ -250,7 +250,6 @@ MAPBOX_API_KEY = os.environ.get('MAPBOX_API_KEY', '') # Maximum number of rows returned in the SQL editor -SQL_MAX_ROW = 1000000 DISPLAY_SQL_MAX_ROW = 1000 # Maximum number of tables/views displayed in the dropdown window in SQL Lab. From 684225b50b56f3bf3e7373477e9799c64d1f87af Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Sat, 14 Jul 2018 00:20:38 +0300 Subject: [PATCH 3/5] Fix test config --- tests/superset_test_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/superset_test_config.py b/tests/superset_test_config.py index 3076a0556cb3b..12c8998e63b00 100644 --- a/tests/superset_test_config.py +++ b/tests/superset_test_config.py @@ -14,7 +14,7 @@ SQL_CELERY_RESULTS_DB_FILE_PATH = os.path.join(DATA_DIR, 'celery_results.sqlite') SQL_SELECT_AS_CTA = True -SQL_MAX_ROW = 666 +DISPLAY_SQL_MAX_ROW = 666 TESTING = True SECRET_KEY = 'thisismyscretkey' From c5e300c20d79c13248bd3351a1acb84a4235bee0 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Sat, 14 Jul 2018 00:23:04 +0300 Subject: [PATCH 4/5] Change to SQL_MAX_ROW --- superset/config.py | 2 +- superset/sql_lab.py | 2 +- tests/superset_test_config.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/config.py b/superset/config.py index 29345af546962..65f3887793951 100644 --- a/superset/config.py +++ b/superset/config.py @@ -250,7 +250,7 @@ MAPBOX_API_KEY = os.environ.get('MAPBOX_API_KEY', '') # Maximum number of rows returned in the SQL editor -DISPLAY_SQL_MAX_ROW = 1000 +SQL_MAX_ROW = 1000 # Maximum number of tables/views displayed in the dropdown window in SQL Lab. MAX_TABLE_NAMES = 3000 diff --git a/superset/sql_lab.py b/superset/sql_lab.py index 1ecf1f5c63fa3..34a9eeb9e3767 100644 --- a/superset/sql_lab.py +++ b/superset/sql_lab.py @@ -129,7 +129,7 @@ def handle_error(msg): # Limit enforced only for retrieving the data, not for the CTA queries. superset_query = SupersetQuery(rendered_query) executed_sql = superset_query.stripped() - SQL_MAX_ROWS = app.config.get('DISPLAY_SQL_MAX_ROW') + SQL_MAX_ROWS = app.config.get('SQL_MAX_ROW') if not superset_query.is_select() and not database.allow_dml: return handle_error( 'Only `SELECT` statements are allowed against this database') diff --git a/tests/superset_test_config.py b/tests/superset_test_config.py index 12c8998e63b00..3076a0556cb3b 100644 --- a/tests/superset_test_config.py +++ b/tests/superset_test_config.py @@ -14,7 +14,7 @@ SQL_CELERY_RESULTS_DB_FILE_PATH = os.path.join(DATA_DIR, 'celery_results.sqlite') SQL_SELECT_AS_CTA = True -DISPLAY_SQL_MAX_ROW = 666 +SQL_MAX_ROW = 666 TESTING = True SECRET_KEY = 'thisismyscretkey' From 4c6d4a3c5d7bbe135a0c4309d984cafef7f8e5ce Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Sat, 14 Jul 2018 00:29:47 +0300 Subject: [PATCH 5/5] Remove last remaining occurence of DISPLAY_SQL_MAX_ROW --- superset/views/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/views/core.py b/superset/views/core.py index 0e51eac044982..7ada916e64cfc 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -2477,7 +2477,7 @@ def results(self, key): '{}'.format(rejected_tables))) payload = utils.zlib_decompress_to_string(blob) - display_limit = app.config.get('DISPLAY_SQL_MAX_ROW', None) + display_limit = app.config.get('SQL_MAX_ROW', None) if display_limit: payload_json = json.loads(payload) payload_json['data'] = payload_json['data'][:display_limit]