superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [incubator-superset] branch master updated: Fix top groups with user defined metrics (#6073)
Date Thu, 11 Oct 2018 16:14:57 GMT
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 247a85b  Fix top groups with user defined metrics (#6073)
247a85b is described below

commit 247a85b916b6f0e15d7d14f7998004f82c53de44
Author: Beto Dealmeida <roberto@dealmeida.net>
AuthorDate: Thu Oct 11 09:14:41 2018 -0700

    Fix top groups with user defined metrics (#6073)
---
 UPDATING.md                        | 2 +-
 superset/connectors/sqla/models.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/UPDATING.md b/UPDATING.md
index 326a57d..b17d32f 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -19,7 +19,7 @@ assists people when migrating to a new version.
 * Superset 0.28 upgrades `flask-login` to `>=0.3`, which includes a
     backwards-incompatible change: `g.user.is_authenticated`,
     `g.user.is_anonymous`, and `g.user.is_active` are now properties
-    instead of properties.
+    instead of methods.
 
 ## Superset 0.27.0
 * Superset 0.27 start to use nested layout for dashboard builder, which is not
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 75251f6..89b07f6 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -757,7 +757,11 @@ class SqlaTable(Model, BaseDatasource):
                     'order_desc': True,
                 }
                 result = self.query(subquery_obj)
-                dimensions = [c for c in result.df.columns if c not in metrics]
+                cols = {col.column_name: col for col in self.columns}
+                dimensions = [
+                    c for c in result.df.columns
+                    if c not in metrics and c in cols
+                ]
                 top_groups = self._get_top_groups(result.df, dimensions)
                 qry = qry.where(top_groups)
 


Mime
View raw message