diff --git a/superset/tasks/slack_util.py b/superset/tasks/slack_util.py index ef647ebd2a5a2..08dcb16c25442 100644 --- a/superset/tasks/slack_util.py +++ b/superset/tasks/slack_util.py @@ -18,15 +18,13 @@ from io import IOBase from typing import cast, 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 # type: ignore logger = logging.getLogger("tasks.slack_util") @@ -34,6 +32,7 @@ def deliver_slack_msg( slack_channel: str, subject: str, body: str, file: Union[str, IOBase] ) -> 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. response = cast( diff --git a/superset/viz.py b/superset/viz.py index 2d9083f982635..08f176bc42035 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -21,6 +21,7 @@ Superset can render. """ import copy +import dataclasses import inspect import logging import math @@ -42,7 +43,6 @@ Union, ) -import dataclasses import geohash import numpy as np import pandas as pd @@ -323,7 +323,8 @@ def query_obj(self) -> QueryObjectDict: 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: