diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py index 3d22857912f10..e72747cc50ff9 100644 --- a/superset/connectors/base/models.py +++ b/superset/connectors/base/models.py @@ -14,15 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +from __future__ import annotations + import json from datetime import datetime from enum import Enum -from typing import Any, Dict, Hashable, List, Optional, Set, Type, Union +from typing import Any, Dict, Hashable, List, Optional, Set, Type, TYPE_CHECKING, Union from flask_appbuilder.security.sqla.models import User from sqlalchemy import and_, Boolean, Column, Integer, String, Text from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import foreign, Query, relationship, RelationshipProperty, Session +from sqlalchemy.sql import literal_column from superset import is_feature_enabled, security_manager from superset.constants import EMPTY_STRING, NULL_STRING @@ -33,6 +36,9 @@ from superset.utils import core as utils from superset.utils.core import GenericDataType, MediumText +if TYPE_CHECKING: + from superset.db_engine_specs.base import BaseEngineSpec + METRIC_FORM_DATA_PARAMS = [ "metric", "metric_2", @@ -387,25 +393,34 @@ def data_for_slices( # pylint: disable=too-many-locals return data @staticmethod - def filter_values_handler( + def filter_values_handler( # pylint: disable=too-many-arguments values: Optional[FilterValues], - target_column_type: utils.GenericDataType, + target_generic_type: GenericDataType, + target_native_type: Optional[str] = None, is_list_target: bool = False, + db_engine_spec: Optional[Type[BaseEngineSpec]] = None, + db_extra: Optional[Dict[str, Any]] = None, ) -> Optional[FilterValues]: if values is None: return None def handle_single_value(value: Optional[FilterValue]) -> Optional[FilterValue]: - # backward compatibility with previous