Skip to content

Commit

Permalink
fix: dedup groupby in viz.py while preserving order (#10633)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and villebro committed Sep 16, 2020
1 parent 029a70b commit 25d9fb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions superset/tasks/slack_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@
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")


@retry(SlackApiError, delay=10, backoff=2, tries=5)
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(
Expand Down
5 changes: 3 additions & 2 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Superset can render.
"""
import copy
import dataclasses
import inspect
import logging
import math
Expand All @@ -42,7 +43,6 @@
Union,
)

import dataclasses
import geohash
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 25d9fb7

Please sign in to comment.