superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnbod...@apache.org
Subject [incubator-superset] 05/43: add missing part
Date Fri, 11 Jan 2019 02:22:09 GMT
This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch feature--embeddable-charts-pilot
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 6e3fbec683babc0bc03b734c1ecbbc250023b0a4
Author: Conglei Shi <conglei.shi@airbnb.com>
AuthorDate: Tue Nov 13 10:33:20 2018 -0800

    add missing part
---
 superset/common/query_object.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/superset/common/query_object.py b/superset/common/query_object.py
index 0d831f6..3add741 100644
--- a/superset/common/query_object.py
+++ b/superset/common/query_object.py
@@ -3,6 +3,8 @@ from typing import Dict, List, Optional
 
 from superset import app
 from superset.utils import core as utils
+import hashlib
+import simplejson as json
 
 # TODO: Type Metrics dictionary with TypedDict when it becomes a vanilla python type
 # https://github.com/python/mypy/issues/5288
@@ -68,4 +70,12 @@ class QueryObject:
 
         cache_dict['time_range'] = self.form_data.get('time_range')
         json_data = self.json_dumps(cache_dict, sort_keys=True)
-        return hashlib.md5(json_data.encode('utf-8')).hexdigest()
\ No newline at end of file
+        return hashlib.md5(json_data.encode('utf-8')).hexdigest()
+    
+    def json_dumps(self, obj, sort_keys=False):
+        return json.dumps(
+            obj,
+            default=utils.json_int_dttm_ser,
+            ignore_nan=True,
+            sort_keys=sort_keys,
+        )
\ No newline at end of file


Mime
View raw message