villebro commented on code in PR #24241:
URL: https://github.com/apache/superset/pull/24241#discussion_r1209699364


##########
superset/db_engine_specs/base.py:
##########
@@ -737,7 +741,27 @@ def fetch_data(
         try:
             if cls.limit_method == LimitMethod.FETCH_MANY and limit:
                 return cursor.fetchmany(limit)
-            return cursor.fetchall()
+            data = cursor.fetchall()
+            description = cursor.description or []
+            column_type_mutators = {
+                row[0]: func
+                for row in description
+                if (
+                    func := cls.column_type_mutators.get(
+                        
type(cls.get_sqla_column_type(cls.get_datatype(row[1])))
+                    )
+                )
+            }
+            if column_type_mutators:

Review Comment:
   It hit me, that without this change, the linked issue won't be fixed, as CSV 
export happens purely in the backend. With this new pattern we could even 
normalize text non-standard timestamps early in the flow, eliminating the need 
for doing it in the frontend, further decoupling the quirks of the analytical 
databases from the downstream logic.



##########
superset/db_engine_specs/base.py:
##########
@@ -737,7 +741,27 @@ def fetch_data(
         try:
             if cls.limit_method == LimitMethod.FETCH_MANY and limit:
                 return cursor.fetchmany(limit)
-            return cursor.fetchall()
+            data = cursor.fetchall()
+            description = cursor.description or []
+            column_type_mutators = {
+                row[0]: func
+                for row in description
+                if (
+                    func := cls.column_type_mutators.get(
+                        
type(cls.get_sqla_column_type(cls.get_datatype(row[1])))
+                    )
+                )
+            }
+            if column_type_mutators:

Review Comment:
   It hit me, that without this change, the linked issue won't be fixed, as CSV 
export happens purely in the backend. With this new pattern we could even 
normalize non-standard timestamps early in the flow, eliminating the need for 
doing it in the frontend, further decoupling the quirks of the analytical 
databases from the downstream logic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to