Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why table view without group by cannot be used in dashboard? #821

Closed
tanminhnu opened this issue Jul 26, 2016 · 8 comments
Closed

Why table view without group by cannot be used in dashboard? #821

tanminhnu opened this issue Jul 26, 2016 · 8 comments

Comments

@tanminhnu
Copy link

tanminhnu commented Jul 26, 2016

Hi guys,

I met an issue, I want to use Table View to show the table column, I succeed to create slice like this:
image

But when I use it into the dashboard, I get this error:
image

I found this error will happened no matter what table I use. Is it a bug?

PS: I just followed the doc to install the caravel : http://airbnb.io/caravel/installation.html#caravel-installation-and-initialization

@xrmx
Copy link
Contributor

xrmx commented Jul 26, 2016

Please paste any exception to get in the caravel logs.

@tanminhnu
Copy link
Author

tanminhnu commented Jul 26, 2016

@xrmx Here is my logs:

2016-07-27 01:22:06,420:DEBUG:MARKDOWN:Successfuly imported extension module "markdown.extensions.tables".
2016-07-27 01:22:06,420:DEBUG:MARKDOWN:Successfully loaded extension "markdown.extensions.tables.TableExtension".
2016-07-27 01:22:06,420:DEBUG:MARKDOWN:Successfuly imported extension module "markdown.extensions.fenced_code".
2016-07-27 01:22:06,420:DEBUG:MARKDOWN:Successfully loaded extension "markdown.extensions.fenced_code.FencedCodeExtension".
2016-07-27 01:22:06,420:DEBUG:MARKDOWN:Successfuly imported extension module "markdown.extensions.codehilite".
2016-07-27 01:22:06,421:DEBUG:MARKDOWN:Successfully loaded extension "markdown.extensions.codehilite.CodeHiliteExtension".
2016-07-27 01:22:06,962:ERROR:root:'NoneType' object is not iterable
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/caravel/views.py", line 827, in explore
payload = obj.get_json()
File "/usr/local/lib/python2.7/site-packages/caravel/viz.py", line 294, in get_json
'data': self.get_data(),
File "/usr/local/lib/python2.7/site-packages/caravel/viz.py", line 414, in get_data
df = self.get_df()
File "/usr/local/lib/python2.7/site-packages/caravel/viz.py", line 406, in get_df
df = super(TableViz, self).get_df(query_obj)
File "/usr/local/lib/python2.7/site-packages/caravel/viz.py", line 144, in get_df
query_obj = self.query_obj()
File "/usr/local/lib/python2.7/site-packages/caravel/viz.py", line 402, in query_obj
d['orderby'] = [json.loads(t) for t in fd.get('order_by_cols', [])]
TypeError: 'NoneType' object is not iterable
2016-07-27 01:22:07,047:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,049:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,057:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,133:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,244:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,275:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,359:INFO:root:Caching for the next None seconds
/usr/local/lib/python2.7/site-packages/caravel/viz.py:997: FutureWarning: sort is deprecated, use sort_values(inplace=True) for INPLACE sorting
dfs.sort(ascending=False)
2016-07-27 01:22:07,507:INFO:root:Caching for the next None seconds
2016-07-27 01:22:07,513:INFO:root:Caching for the next None seconds

@rhp4515
Copy link
Contributor

rhp4515 commented Jul 27, 2016

Duplicate as #812

@mistercrunch
Copy link
Member

#823

@spspaul
Copy link

spspaul commented Oct 12, 2016

For those who continue to run into this exception (like me)
even after getting the fix from #823, you must chose at least
one value for Ordering under NOT GROUPED BY
when building the slice or you will run into same exception when
trying to use the slice in a dashboard.

@kylozw
Copy link

kylozw commented Oct 25, 2016

Same issue when download csv in slice.
Choosing one value for Ordering under NOT GROUPED BY worked.

@spspaul
Copy link

spspaul commented Oct 30, 2016

@kylozw ,

FWIW, Ordering does not take all columns, just ones of certain types.
What I do in order to:

  • satisfy Caravel's need to have at least one value for Ordering
  • get things sorted the way I want when using NOT GROUPED BY

I define a view in the database where the first column is defined like so:

CREATE OR REPLACE VIEW blar AS
SELECT RANK() OVER (ORDER BY col1, col2, etc) AS order_id,

I use then use blar as Source/Table.
In Caravel/Slice definition, I specify order_id for Ordering.

Good luck.

@521xueweihan
Copy link

Thanks spspaul:

Solution:

you must chose at least
one value for Ordering under NOT GROUPED BY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants