Skip to content

Commit

Permalink
[hotfix] fix support for presto DATE and TIMESTAMP type
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Nov 11, 2016
1 parent 7325a4f commit d6bc354
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ class PrestoEngineSpec(BaseEngineSpec):

@classmethod
def convert_dttm(cls, target_type, dttm):
if target_type.upper() in ('DATE', 'DATETIME'):
return "from_iso8601_date('{}')".format(dttm.isoformat())
tt = target_type.upper()
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'))

@classmethod
Expand Down

0 comments on commit d6bc354

Please sign in to comment.