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

Hotfix. Put back a default count * metric #2091

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions superset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,15 +1320,8 @@ def query( # sqla
for s in columns:
select_exprs.append(cols[s].sqla_col)
metrics_exprs = []
elif not is_timeseries:
# use all columns if none were specified
for col_obj in cols.values():
select_exprs.append(col_obj.sqla_col)
metrics_exprs = []
row_limit = row_limit or 100

if granularity:

@compiles(ColumnClause)
def visit_column(element, compiler, **kw):
"""Patch for sqlalchemy bug
Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def query_obj(self):
"""Building a query object"""
form_data = self.form_data
groupby = form_data.get("groupby") or []
metrics = form_data.get("metrics") or []
metrics = form_data.get("metrics") or ['count']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mostly-safe assumption as we create that metric on behalf of the user. Though a user could remove that metric, of a new datasource type may not know that it has to create a count by default.

I had to dealt with this while deprecating v1 as defaults are now set on the client side and decided to take the first metric from the list of possible metric for the datasource.

I'm fine either way, just wanted to chime in.

extra_filters = self.get_extra_filters()
granularity = (
form_data.get("granularity") or form_data.get("granularity_sqla")
Expand Down