Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tzinfo config, useful when start druid without utc timezone #20

Merged
merged 1 commit into from
Sep 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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 = {
Expand Down