Skip to content

Commit

Permalink
Merge pull request #20 from wbchn/master
Browse files Browse the repository at this point in the history
add tzinfo config, useful when start druid without utc timezone
  • Loading branch information
mistercrunch committed Sep 9, 2015
2 parents 6dd81a3 + 11aaaf3 commit 7f9d96b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions panoramix/config.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
#----------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import textwrap

from panoramix import db, get_session
import config

QueryResult = namedtuple('namedtuple', ['df', 'query', 'duration'])

Expand Down Expand Up @@ -528,6 +529,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 = {
Expand Down

0 comments on commit 7f9d96b

Please sign in to comment.