mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
feat: Add new timegrains and convert_dttm to Druid engine spec (#10160)
* feat: Add new timegrains and convert_dttm to Druid engine spec * Add TemporalType enum and fix test case * Remove DATETIME for athena (original spec)
This commit is contained in:
@@ -198,9 +198,9 @@ class HiveEngineSpec(PrestoEngineSpec):
|
||||
@classmethod
|
||||
def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]:
|
||||
tt = target_type.upper()
|
||||
if tt == "DATE":
|
||||
if tt == utils.TemporalType.DATE:
|
||||
return f"CAST('{dttm.date().isoformat()}' AS DATE)"
|
||||
if tt == "TIMESTAMP":
|
||||
if tt == utils.TemporalType.TIMESTAMP:
|
||||
return f"""CAST('{dttm.isoformat(sep=" ", timespec="microseconds")}' AS TIMESTAMP)""" # pylint: disable=line-too-long
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user