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
1 changed files with 2 additions and 1 deletions

View File

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