You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/11 20:20:04 UTC

[GitHub] [superset] ktmud commented on a change in pull request #13082: fix(sql_lab): Add custom timestamp type for literal casting for presto timestamps

ktmud commented on a change in pull request #13082:
URL: https://github.com/apache/superset/pull/13082#discussion_r574800349



##########
File path: superset/models/sql_types/presto_sql_types.py
##########
@@ -91,3 +92,17 @@ def python_type(self) -> Optional[Type[Any]]:
     @classmethod
     def _compiler_dispatch(cls, _visitor: Visitable, **_kw: Any) -> str:
         return "ROW"
+
+class TimeStamp(types.TypeDecorator):
+    """
+    A type to extend functionality of timestamp data type.
+    """
+
+    impl = TIMESTAMP
+
+    def process_bind_param(self, value, dialect):
+        """
+        Used for in-line rendering of TIMESTAMP data type
+        as Presto does not support automatic casting.
+        """
+        return "TIMESTAMP '%s'" % value

Review comment:
       nit: missing EOF  (CI will fail)




----------------------------------------------------------------
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.

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



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