Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #111 from airbnb/bump_simplejson_version
Browse files Browse the repository at this point in the history
cherry pick apache#5121
  • Loading branch information
timifasubaa authored Sep 14, 2018
2 parents 5932ab3 + 84c83df commit 2fbdc37
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ python-dateutil==2.6.1
python-geohash==0.8.5
pyyaml==3.12
requests==2.18.4
simplejson==3.13.2
simplejson==3.15.0
six==1.11.0
sqlalchemy==1.2.2
sqlalchemy-utils==0.32.21
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_git_sha():
'python-geohash',
'pyyaml>=3.11',
'requests',
'simplejson',
'simplejson>=3.15.0',
'six',
'sqlalchemy',
'sqlalchemy-utils',
Expand Down
6 changes: 5 additions & 1 deletion superset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def datetime_f(dttm):


def base_json_conv(obj):

if isinstance(obj, numpy.int64):
return int(obj)
elif isinstance(obj, numpy.bool_):
Expand All @@ -324,6 +323,11 @@ def base_json_conv(obj):
return str(obj)
elif isinstance(obj, timedelta):
return str(obj)
elif isinstance(obj, bytes):
try:
return '{}'.format(obj)
except Exception:
return '[bytes]'


def json_iso_dttm_ser(obj, pessimistic=False):
Expand Down
6 changes: 5 additions & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,11 @@ def sql_json(self):
rendered_query,
return_results=True)
payload = json.dumps(
data, default=utils.pessimistic_json_iso_dttm_ser, ignore_nan=True)
data,
default=utils.pessimistic_json_iso_dttm_ser,
ignore_nan=True,
encoding=None,
)
except Exception as e:
logging.exception(e)
return json_error_response('{}'.format(e))
Expand Down

0 comments on commit 2fbdc37

Please sign in to comment.