giftig commented on code in PR #24054:
URL: https://github.com/apache/superset/pull/24054#discussion_r1193816645


##########
superset/db_engine_specs/presto.py:
##########
@@ -509,13 +507,13 @@ def where_latest_partition(  # pylint: 
disable=too-many-arguments
         }
 
         for col_name, value in zip(col_names, values):
-            if col_name in column_type_by_name:
-                if column_type_by_name.get(col_name) == "TIMESTAMP":
-                    query = query.where(Column(col_name, TimeStamp()) == value)
-                elif column_type_by_name.get(col_name) == "DATE":
-                    query = query.where(Column(col_name, Date()) == value)
-                else:
-                    query = query.where(Column(col_name) == value)
+            col_type = column_type_by_name.get(col_name)
+
+            if isinstance(col_type, (types.DATE, types.TIMESTAMP)):
+                value = text(f"{col_type} '{value}'")

Review Comment:
   I'd ideally like to rely on sqlalchemy to correctly format my value, but I 
couldn't find a way to do it. Attempting to use `cast()` didn't work, for 
example, as sqlalchemy told me it didn't know how to literally print the string 
we have here. I couldn't see a trivial way of constructing the relevant sqla 
type from the string value we have, either.



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to