Merge pull request #20 from wbchn/master
add tzinfo config, useful when start druid without utc timezone
This commit is contained in:
commit
7f9d96b024
|
|
@ -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 @@ APP_NAME = "Panoramix"
|
|||
# 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
|
||||
#----------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import requests
|
|||
import textwrap
|
||||
|
||||
from panoramix import db, get_session
|
||||
import config
|
||||
|
||||
QueryResult = namedtuple('namedtuple', ['df', 'query', 'duration'])
|
||||
|
||||
|
|
@ -528,6 +529,8 @@ class Datasource(Model, AuditMixin, Queryable):
|
|||
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 = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue