mirror of https://github.com/apache/superset.git
[hotfix] fix support for presto DATE and TIMESTAMP type
This commit is contained in:
parent
7325a4fb4b
commit
d6bc354ff3
|
@ -174,8 +174,11 @@ class PrestoEngineSpec(BaseEngineSpec):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def convert_dttm(cls, target_type, dttm):
|
def convert_dttm(cls, target_type, dttm):
|
||||||
if target_type.upper() in ('DATE', 'DATETIME'):
|
tt = target_type.upper()
|
||||||
return "from_iso8601_date('{}')".format(dttm.isoformat())
|
if tt == 'DATE':
|
||||||
|
return "from_iso8601_date('{}')".format(dttm.isoformat()[:10])
|
||||||
|
if tt == 'TIMESTAMP':
|
||||||
|
return "from_iso8601_timestamp('{}')".format(dttm.isoformat())
|
||||||
return "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
|
return "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue