From 9a63a312b6518c58d4423d2297f5482e468f56db Mon Sep 17 00:00:00 2001 From: Maxime Date: Wed, 9 Sep 2015 20:54:21 +0000 Subject: [PATCH] Warn on row limit reached --- panoramix/config.py | 2 +- panoramix/templates/panoramix/datasource.html | 7 +++++-- panoramix/viz.py | 10 +++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/panoramix/config.py b/panoramix/config.py index aa534e3273b6e..4ea6e34e1ea6f 100644 --- a/panoramix/config.py +++ b/panoramix/config.py @@ -15,7 +15,7 @@ # --------------------------------------------------------- # Panoramix specifix config # --------------------------------------------------------- -ROW_LIMIT = 5000 +ROW_LIMIT = 50000 WEBSERVER_THREADS = 8 PANORAMIX_WEBSERVER_PORT = 8088 diff --git a/panoramix/templates/panoramix/datasource.html b/panoramix/templates/panoramix/datasource.html index a7a68410c6f2c..e8d32ae3f1899 100644 --- a/panoramix/templates/panoramix/datasource.html +++ b/panoramix/templates/panoramix/datasource.html @@ -109,8 +109,11 @@

{{ viz.verbose_name }}


{% block viz %} - {% if error_msg %} -
{{ error_msg }}
+ {% if viz.error_msg %} +
{{ viz.error_msg }}
+ {% endif %} + {% if viz.warning_msg %} +
{{ viz.warning_msg }}
{% endif %} {% endblock %} diff --git a/panoramix/viz.py b/panoramix/viz.py index 9118663fbdf9f..8a4a51bbee076 100644 --- a/panoramix/viz.py +++ b/panoramix/viz.py @@ -90,7 +90,7 @@ def query_obj(self): # extras are used to query elements specific to a datasource type # for instance the extra where clause that applies only to Tables extras = { - 'where': args.get("where") + 'where': args.get("where", '') } d = { 'granularity': granularity, @@ -111,6 +111,14 @@ def render_no_data(self): return BaseViz.render(self) def check_and_render(self, *args, **kwards): + if ( + hasattr(self, 'df') and + self.df is not None and + len(self.df) == config.ROW_LIMIT): + self.warning_msg = ( + "Doh! The system limit of {} rows was reached, " + "showing partial results.").format(config.ROW_LIMIT) + if self.error_msg: return BaseViz.render(self, error_msg=self.error_msg) else: