Warn on row limit reached

This commit is contained in:
Maxime 2015-09-09 20:54:21 +00:00
parent 5825f4539d
commit 9a63a312b6
3 changed files with 15 additions and 4 deletions

View File

@ -15,7 +15,7 @@ There' a ``from local_config import *`` at the end of this file.
# ---------------------------------------------------------
# Panoramix specifix config
# ---------------------------------------------------------
ROW_LIMIT = 5000
ROW_LIMIT = 50000
WEBSERVER_THREADS = 8
PANORAMIX_WEBSERVER_PORT = 8088

View File

@ -109,8 +109,11 @@ form input.form-control {
</h3>
<hr/>
{% block viz %}
{% if error_msg %}
<div class="alert alert-danger">{{ error_msg }}</div>
{% if viz.error_msg %}
<div class="alert alert-danger">{{ viz.error_msg }}</div>
{% endif %}
{% if viz.warning_msg %}
<div class="alert alert-warning">{{ viz.warning_msg }}</div>
{% endif %}
{% endblock %}

View File

@ -90,7 +90,7 @@ class BaseViz(object):
# 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 @@ class BaseViz(object):
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: