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 2019/10/29 18:00:44 UTC

[GitHub] [incubator-superset] john-bodley commented on a change in pull request #8464: [SIP-15] Fixing datetime conversion and SQL literal

john-bodley commented on a change in pull request #8464: [SIP-15] Fixing datetime conversion and SQL literal
URL: https://github.com/apache/incubator-superset/pull/8464#discussion_r340239024
 
 

 ##########
 File path: superset/db_engine_specs/mssql.py
 ##########
 @@ -50,8 +50,10 @@ def epoch_to_dttm(cls):
         return "dateadd(S, {col}, '1970-01-01')"
 
     @classmethod
-    def convert_dttm(cls, target_type: str, dttm: datetime) -> str:
-        return "CONVERT(DATETIME, '{}', 126)".format(dttm.isoformat())
+    def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]:
+        if target_type.upper() in ("DATE", "DATETIME", "SMALLDATETIME", "TIMESTAMP"):
+            return f"CONVERT(DATETIME, '{dttm.isoformat()}', 126)"
 
 Review comment:
   @villebro I addressed your comment. 

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


With regards,
Apache Git Services

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