This is an automated email from the ASF dual-hosted git repository. villebro pushed a commit to branch 0.38 in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 7d62a72367e8d381b8f0ef470704b9d12228c77d Author: Maxime Beauchemin <[email protected]> AuthorDate: Thu Aug 20 22:02:02 2020 -0700 fix: dedup groupby in viz.py while preserving order (#10633) --- superset/tasks/slack_util.py | 5 ++--- superset/viz.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/tasks/slack_util.py b/superset/tasks/slack_util.py index 64e9923..a646d7d 100644 --- a/superset/tasks/slack_util.py +++ b/superset/tasks/slack_util.py @@ -18,15 +18,13 @@ import logging from io import IOBase from typing import cast, Optional, Union +from flask import current_app from retry.api import retry from slack import WebClient from slack.errors import SlackApiError from slack.web.slack_response import SlackResponse -from superset import app - # Globals -config = app.config logger = logging.getLogger("tasks.slack_util") @@ -37,6 +35,7 @@ def deliver_slack_msg( body: str, file: Optional[Union[str, IOBase, bytes]], ) -> None: + config = current_app.config client = WebClient(token=config["SLACK_API_TOKEN"], proxy=config["SLACK_PROXY"]) # files_upload returns SlackResponse as we run it in sync mode. if file: diff --git a/superset/viz.py b/superset/viz.py index 19b1a81..17bebc7 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -323,7 +323,8 @@ class BaseViz: gb = self.groupby metrics = self.all_metrics or [] columns = form_data.get("columns") or [] - groupby = list(set(gb + columns)) + # merge list and dedup while preserving order + groupby = list(OrderedDict.fromkeys(gb + columns)) is_timeseries = self.is_timeseries if DTTM_ALIAS in groupby:
