diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index f894496dcff..b25d09bceb2 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -721,6 +721,9 @@ class SqlaTable(Model, BaseDatasource): groupby_exprs_sans_timestamp: OrderedDict = OrderedDict() if groupby: + # dedup columns while preserving order + groupby = list(dict.fromkeys(groupby)) + select_exprs = [] for s in groupby: if s in cols: diff --git a/superset/viz.py b/superset/viz.py index b6d89fbda23..8cbb2ecdf99 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -970,6 +970,10 @@ class BubbleViz(NVD3Viz): d["groupby"] = [form_data.get("entity")] if form_data.get("series"): d["groupby"].append(form_data.get("series")) + + # dedup groupby if it happens to be the same + d["groupby"] = list(dict.fromkeys(d["groupby"])) + self.x_metric = form_data.get("x") self.y_metric = form_data.get("y") self.z_metric = form_data.get("size")