Skip to content

Commit

Permalink
Warn on row limit reached
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 9, 2015
1 parent 5825f45 commit 9a63a31
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion panoramix/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ---------------------------------------------------------
# Panoramix specifix config
# ---------------------------------------------------------
ROW_LIMIT = 5000
ROW_LIMIT = 50000
WEBSERVER_THREADS = 8

PANORAMIX_WEBSERVER_PORT = 8088
Expand Down
7 changes: 5 additions & 2 deletions panoramix/templates/panoramix/datasource.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ <h3>{{ viz.verbose_name }}
</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 %}

Expand Down
10 changes: 9 additions & 1 deletion panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down

0 comments on commit 9a63a31

Please sign in to comment.