This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch fix_mess
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 39fedacb958e498f4905882dfd8301303dc46bd5
Author: Maxime Beauchemin <maximebeauche...@gmail.com>
AuthorDate: Tue Jul 15 12:12:32 2025 -0700

    de-duping further
---
 superset/connectors/sqla/models.py | 45 --------------------------------------
 superset/models/helpers.py         |  9 +++++---
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/superset/connectors/sqla/models.py 
b/superset/connectors/sqla/models.py
index c9c6d5faf9..fe5ef84abc 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -26,8 +26,6 @@ from dataclasses import dataclass, field
 from datetime import datetime, timedelta
 from typing import Any, Callable, cast, Optional, Union
 
-import dateutil.parser
-import numpy as np
 import pandas as pd
 import sqlalchemy as sa
 from flask_appbuilder import Model
@@ -1167,12 +1165,6 @@ class SqlaTable(
     def db_engine_spec(self) -> __builtins__.type[BaseEngineSpec]:
         return self.database.db_engine_spec
 
-    @property
-    def changed_by_name(self) -> str:
-        if not self.changed_by:
-            return ""
-        return str(self.changed_by)
-
     @property
     def connection(self) -> str:
         return str(self.database)
@@ -1529,43 +1521,6 @@ class SqlaTable(
             )
         return ob
 
-    def _normalize_prequery_result_type(
-        self,
-        row: pd.Series,
-        dimension: str,
-        columns_by_name: dict[str, TableColumn],
-    ) -> str | int | float | bool | Text:
-        """
-        Convert a prequery result type to its equivalent Python type.
-
-        Some databases like Druid will return timestamps as strings, but do 
not perform
-        automatic casting when comparing these strings to a timestamp. For 
cases like
-        this we convert the value via the appropriate SQL transform.
-
-        :param row: A prequery record
-        :param dimension: The dimension name
-        :param columns_by_name: The mapping of columns by name
-        :return: equivalent primitive python type
-        """
-
-        value = row[dimension]
-
-        if isinstance(value, np.generic):
-            value = value.item()
-
-        column_ = columns_by_name.get(dimension)
-        db_extra: dict[str, Any] = self.database.get_extra()
-
-        if column_ and column_.type and column_.is_temporal and 
isinstance(value, str):
-            sql = self.db_engine_spec.convert_dttm(
-                column_.type, dateutil.parser.parse(value), db_extra=db_extra
-            )
-
-            if sql:
-                value = self.text(sql)
-
-        return value
-
     def _get_top_groups(
         self,
         df: pd.DataFrame,
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 813b6c7341..930b84aa34 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -919,10 +919,13 @@ class ExploreMixin:  # pylint: 
disable=too-many-public-methods
         if isinstance(value, np.generic):
             value = value.item()
 
-        column_ = columns_by_name[dimension]
+        column_ = columns_by_name.get(dimension)
         db_extra: dict[str, Any] = self.database.get_extra()
 
-        if isinstance(column_, dict):
+        if column_ is None:
+            # Column not found, return value as-is
+            pass
+        elif isinstance(column_, dict):
             if (
                 column_.get("type")
                 and column_.get("is_temporal")
@@ -941,7 +944,7 @@ class ExploreMixin:  # pylint: 
disable=too-many-public-methods
                 )
 
                 if sql:
-                    value = self.text(sql)
+                    value = self.db_engine_spec.get_text_clause(sql)
         return value
 
     def make_orderby_compatible(

Reply via email to