diff --git a/panoramix/config.py b/panoramix/config.py index cb4bf8cff58fe..eb61b64a4ba3b 100644 --- a/panoramix/config.py +++ b/panoramix/config.py @@ -1,6 +1,7 @@ import os from flask_appbuilder.security.manager import AUTH_OID, AUTH_REMOTE_USER, AUTH_DB, AUTH_LDAP, AUTH_OAUTH basedir = os.path.abspath(os.path.dirname(__file__)) +from dateutil import tz """ All configuration in this file can be overridden by providing a local_config @@ -41,6 +42,12 @@ # Uncomment to setup Setup an App icon APP_ICON = "/static/chaudron_white.png" +# Druid query timezone +# tz.tzutc() : Using utc timezone +# tz.tzlocal() : Using local timezone +# other tz can be overridden by providing a local_config +DRUID_TZ = tz.tzutc() + #---------------------------------------------------- # AUTHENTICATION CONFIG #---------------------------------------------------- diff --git a/panoramix/models.py b/panoramix/models.py index 4f785cb36a65c..08bcf9778bb6b 100644 --- a/panoramix/models.py +++ b/panoramix/models.py @@ -23,6 +23,7 @@ import textwrap from panoramix import db, get_session +import config QueryResult = namedtuple('namedtuple', ['df', 'query', 'duration']) @@ -524,6 +525,8 @@ def query( timeseries_limit=None, row_limit=None): qry_start_dttm = datetime.now() + from_dttm = from_dttm.replace(tzinfo=config.DRUID_TZ) # add tzinfo to native datetime with config + to_dttm = to_dttm.replace(tzinfo=config.DRUID_TZ) query_str = "" aggregations = {