Open noxdafox opened 6 months ago
This problem is originated by the PR https://github.com/getredash/redash/pull/6685 . I think it's made huge interoperability problem.
I suggest to use orjson. It allows nan, too. In general, it's faster than json and simplejson.
Issue Summary
The following commit https://github.com/getredash/redash/commit/4d5103978bdc20900f205532b48356ec80339632, introduced a regression. As
simplejson
was replaced withjson
strict JSON validation is now enforced.The belief is that JSON validation was enforced to prevent the
json
module to returnNaN
values which break the frontend: https://github.com/getredash/redash/blob/master/redash/utils/__init__.py#L129Yet, the change and the comments suggest that this was not the expected behaviour: https://github.com/getredash/redash/blob/master/redash/utils/__init__.py#L128
Previous to that commit,
NaN
values were allowed and automatically converted toNone
bysimplejson
.json
does not support this functionality and now the behaviour is to raiseValueError
effectively crashing the query every time aNaN
value is encountered.This is breaking several of our queries as
null
values are acceptable in many DB implementations in place of floats/doubles/reals.To revert back to the previous behaviour, either
simplejson
is reinstated as JSON serialization library, or a customJSONEncoder
class is provided (and maintained) instead: https://stackoverflow.com/questions/28639953/python-json-encoder-convert-nans-to-null-insteadTechnical details:
preview
any
Docker