mirror of
https://github.com/apache/superset.git
synced 2026-05-12 11:25:56 +00:00
fix: Ensure verbose mapping exists for SQL Lab Query model (#23597)
This commit is contained in:
@@ -27,7 +27,7 @@ for these chart types.
|
||||
"""
|
||||
|
||||
from io import StringIO
|
||||
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING
|
||||
from typing import Any, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
|
||||
|
||||
import pandas as pd
|
||||
from flask_babel import gettext as __
|
||||
@@ -42,6 +42,7 @@ from superset.utils.core import (
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from superset.connectors.base.models import BaseDatasource
|
||||
from superset.models.sql_lab import Query
|
||||
|
||||
|
||||
def get_column_key(label: Tuple[str, ...], metrics: List[str]) -> Tuple[Any, ...]:
|
||||
@@ -223,7 +224,7 @@ pivot_v2_aggfunc_map = {
|
||||
def pivot_table_v2(
|
||||
df: pd.DataFrame,
|
||||
form_data: Dict[str, Any],
|
||||
datasource: Optional["BaseDatasource"] = None,
|
||||
datasource: Optional[Union["BaseDatasource", "Query"]] = None,
|
||||
) -> pd.DataFrame:
|
||||
"""
|
||||
Pivot table v2.
|
||||
@@ -249,7 +250,7 @@ def pivot_table_v2(
|
||||
def pivot_table(
|
||||
df: pd.DataFrame,
|
||||
form_data: Dict[str, Any],
|
||||
datasource: Optional["BaseDatasource"] = None,
|
||||
datasource: Optional[Union["BaseDatasource", "Query"]] = None,
|
||||
) -> pd.DataFrame:
|
||||
"""
|
||||
Pivot table (v1).
|
||||
@@ -285,7 +286,9 @@ def pivot_table(
|
||||
def table(
|
||||
df: pd.DataFrame,
|
||||
form_data: Dict[str, Any],
|
||||
datasource: Optional["BaseDatasource"] = None, # pylint: disable=unused-argument
|
||||
datasource: Optional[ # pylint: disable=unused-argument
|
||||
Union["BaseDatasource", "Query"]
|
||||
] = None,
|
||||
) -> pd.DataFrame:
|
||||
"""
|
||||
Table.
|
||||
@@ -314,7 +317,7 @@ post_processors = {
|
||||
def apply_post_process(
|
||||
result: Dict[Any, Any],
|
||||
form_data: Optional[Dict[str, Any]] = None,
|
||||
datasource: Optional["BaseDatasource"] = None,
|
||||
datasource: Optional[Union["BaseDatasource", "Query"]] = None,
|
||||
) -> Dict[Any, Any]:
|
||||
form_data = form_data or {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user