fix: the calculated columns explicit type convert into date (#14813)

This commit is contained in:
Yongjie Zhao 2021-05-26 13:33:20 +01:00 committed by GitHub
parent 3224e75193
commit 6bdbd2bf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,8 @@ class TableColumn(Model, BaseColumn):
], ],
) -> str: ) -> str:
"""Convert datetime object to a SQL expression string""" """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: if sql:
return sql return sql