You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/09/16 06:35:15 UTC
[incubator-superset] 19/28: fix: dedup groupby in viz.py while
preserving order (#10633)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 0.37
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 25d9fb75445955fdd4fccec59393c804fccee053
Author: Maxime Beauchemin <ma...@gmail.com>
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 | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/superset/tasks/slack_util.py b/superset/tasks/slack_util.py
index ef647eb..08dcb16 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, 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 @@ logger = logging.getLogger("tasks.slack_util")
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 2d9083f..08f176b 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -21,6 +21,7 @@ These objects represent the backend of all the visualizations that
Superset can render.
"""
import copy
+import dataclasses
import inspect
import logging
import math
@@ -42,7 +43,6 @@ from typing import (
Union,
)
-import dataclasses
import geohash
import numpy as np
import pandas as pd
@@ -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: