-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Issues with Date JSON Serialization #486
Comments
So it doesn't seem to matter whether the grouped column (trans_day) is marked as dttm column. It has the same error no matter what. So It must be auto detected the YYYY-MM-DD format and trying to do something with it? |
Same here with 0.9.0, i got this on a new project when opening the page to create a new slice (http://127.0.0.1:8088/caravel/explore/table/3/) I've added this to help debugging:
It explodes with this:
This how my data is structured:
|
It looks like COUNT(*) returns a numpy.int64 value that the default JSONEncoder does not handle. While at if we get a type we are not handling make it easier to debug the issue by throwing a TypeError exception with useful data. Fix apache#486
It looks like COUNT(*) returns a numpy.int64 value that the default JSONEncoder does not handle. While at if we get a type we are not handling make it easier to debug the issue by throwing a TypeError exception with useful data. Fix #486
I am having an issue where Python reports a circular reference.
I believe the the issue comes up here:
def json_iso_dttm_ser(obj):
"""
json serializer that deals with dates
>>> dttm = datetime(1970, 1, 1)
>>> json.dumps({'dttm': dttm}, default=json_iso_dttm_ser)
'{"dttm": "1970-01-01T00:00:00"}'
"""
if isinstance(obj, datetime):
obj = obj.isoformat()
return obj
(in utils.py)
Based on http://stackoverflow.com/questions/14249115/serializing-output-to-json-valueerror-circular-reference-detected
My data I am querying my data source directly (this is the exact query that caravel is trying to run) I get these results:
trans_day is selected as a dttm column... I am just confused at why this cirucular reference is coming up...
+-------------+--------+
| trans_day | cnt |
+-------------+--------+
| 2015-06-02 | 13265 |
| 2015-01-06 | 13031 |
| 2015-05-19 | 12875 |
| 2015-06-16 | 12746 |
| 2015-05-28 | 12724 |
| 2015-05-26 | 12692 |
| 2015-04-21 | 12617 |
| 2015-06-03 | 12410 |
| 2015-05-05 | 12317 |
| 2015-04-07 | 12308 |
+-------------+--------+
The full stack trace is:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
return f(self, _args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/caravel/models.py", line 1294, in wrapper
return f(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/caravel/views.py", line 557, in explore
payload = obj.get_json()
File "/usr/local/lib/python2.7/dist-packages/caravel/viz.py", line 269, in get_json
return self.json_dumps(payload)
File "/usr/local/lib/python2.7/dist-packages/caravel/viz.py", line 375, in json_dumps
return json.dumps(obj, default=utils.json_iso_dttm_ser)
File "/usr/lib/python2.7/json/init.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
ValueError: Circular reference detected
The text was updated successfully, but these errors were encountered: