You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yo...@apache.org on 2021/05/26 12:34:27 UTC

[superset] branch master updated: fix: the calculated columns explicit type convert into date (#14813)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6bdbd2b  fix: the calculated columns explicit type convert into date (#14813)
6bdbd2b is described below

commit 6bdbd2bf5059dac58e65cdf3fbafe618e182d907
Author: Yongjie Zhao <yo...@gmail.com>
AuthorDate: Wed May 26 13:33:20 2021 +0100

    fix: the calculated columns explicit type convert into date (#14813)
---
 superset/connectors/sqla/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index bc8012b..4ae3efb 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -309,7 +309,8 @@ class TableColumn(Model, BaseColumn):
         ],
     ) -> str:
         """Convert datetime object to a SQL expression string"""
-        sql = self.db_engine_spec.convert_dttm(self.type, dttm) if self.type else None
+        dttm_type = self.type or ("DATETIME" if self.is_dttm else None)
+        sql = self.db_engine_spec.convert_dttm(dttm_type, dttm) if dttm_type else None
 
         if sql:
             return sql