Skip to content
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

Exception occurred when add json param to request.args #24

Closed
wbchn opened this issue Sep 15, 2015 · 4 comments
Closed

Exception occurred when add json param to request.args #24

wbchn opened this issue Sep 15, 2015 · 4 comments

Comments

@wbchn
Copy link
Contributor

wbchn commented Sep 15, 2015

I read the source of Panoramix, it support get query json by add json to requests.args:

        if request.args.get("json"):
            return Response(
                json.dumps(obj.get_query(), indent=4),
                status=200,
                mimetype="application/json")

But when i using this, an exception occurred like this, the BaseViz class hasn't this method:

>>> request.args
werkzeug.datastructures.ImmutableMultiDict({..., 'json': u'1', ...  })

Exception:
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/panoramix-0.2.1-py2.7.egg/panoramix/views.py", line 221, in datasource
json.dumps(obj.get_query(), indent=4),
AttributeError: 'TableViz' object has no attribute 'get_query'

The code may be json.dumps(obj.query_obj(), indent=4), is it right?

@wbchn
Copy link
Contributor Author

wbchn commented Sep 15, 2015

I notice the result of query_obj is not a json of query, maybe it does not support json in current version?

{'extras': {'where': ''},
 'filter': [(u'id', u'in', u'0')],
 'from_dttm': datetime.datetime(2015, 9, 8, 1, 34, 24),
 'granularity': 86400000.0,
 'groupby': [],
 'is_timeseries': True,
 'metrics': [u'sumcount'],
 'row_limit': 10,
 'timeseries_limit': 0,
 'to_dttm': datetime.datetime(2015, 9, 15, 1, 34, 24)
}

@mistercrunch
Copy link
Member

All of this is changing quite a bit in a branch I'm working on, expect the API to change quite a bite until it stabilizes.

Are you interested in getting an endpoint where you can get the Druid query json? I can make sure that this makes it in as a requirement.

@wbchn
Copy link
Contributor Author

wbchn commented Nov 21, 2015

Some time I checked the query json, because we using druid without UTC timezone, query granularity like this:

{"type": "period", "period": "P1D", "timeZone": "America/Los_Angeles"}

We found granularity work not good when we setting "one day" in Time Granularity. So I want check and fix it.

@mistercrunch
Copy link
Member

Old issue, closing.

michellethomas pushed a commit to michellethomas/panoramix that referenced this issue Mar 16, 2018
…oxAndAnnotation

cherry pick mapbox and annotation fix
hughhhh referenced this issue in lyft/incubator-superset Apr 1, 2018
betodealmeida pushed a commit that referenced this issue Sep 20, 2019
merge from apache/lyft-release-sp8
mistercrunch added a commit that referenced this issue Jul 29, 2020
using withTheme to avoid raw supersetTheme
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this issue Oct 4, 2021
zhaoyongjie pushed a commit that referenced this issue Nov 30, 2021
* fix: docs updated with queriesData

* chore: package linting

* fix: restoring missing controls

* feat: sections.legacyRegularTime
rguerraZero added a commit to rguerraZero/superset that referenced this issue Feb 9, 2024
…erset-embedded-sdk/webpack-5.76.0

Build(deps-dev): Bump webpack from 5.67.0 to 5.76.0 in /superset-embedded-sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants