You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/08/30 18:56:45 UTC
[incubator-superset] branch master updated: [hive] fix date casting
in explore view (#3394)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 497a6f1 [hive] fix date casting in explore view (#3394)
497a6f1 is described below
commit 497a6f1df9c63afc9a065a005c733b8b428babad
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Wed Aug 30 11:56:43 2017 -0700
[hive] fix date casting in explore view (#3394)
---
superset/db_engine_specs.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 8ff8ef7..bf4940b 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -687,6 +687,16 @@ class HiveEngineSpec(PrestoEngineSpec):
db, datasource_type, force=force)
@classmethod
+ def convert_dttm(cls, target_type, dttm):
+ tt = target_type.upper()
+ if tt == 'DATE':
+ return "CAST('{}' AS DATE)".format(dttm.isoformat()[:10])
+ elif tt == 'TIMESTAMP':
+ return "CAST('{}' AS TIMESTAMP)".format(
+ dttm.strftime('%Y-%m-%d %H:%M:%S'))
+ return "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
+
+ @classmethod
def adjust_database_uri(cls, uri, selected_schema=None):
if selected_schema:
uri.database = selected_schema
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].