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

Feature: query string API endpoint #3513

Merged
merged 5 commits into from
Sep 26, 2017

Conversation

Mogball
Copy link
Contributor

@Mogball Mogball commented Sep 22, 2017

Exposes an endpoint superset/slices/<slice_id>/query that returns the corresponding query string and language for that slice in the form { query: querystring, language: querylang }, which would be seen when clicking on Query in the explore slice view.

Also includes some unit tests.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.2%) to 69.739% when pulling 977680b on Mogball:mogball/feature/query_apiendpoint into 9af34ba on apache:master.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.3%) to 69.814% when pulling b264960 on Mogball:mogball/feature/query_apiendpoint into 9af34ba on apache:master.

@mistercrunch
Copy link
Member

There's a bit of duplication of logic with what is going on here: https://github.com/apache/incubator-superset/blob/master/superset/views/core.py#L972 . What is the use-case for this endpoint?

Perhaps we can add corresponding routing for slice_id querystring instead of form_data. I think we do it with redirect logic in some places, may work for you, or we could avoid redirecting and just serve from that url.

One behavior that we want to have/preserve is around being able to reference a slice and override some elements easily.

@Mogball
Copy link
Contributor Author

Mogball commented Sep 22, 2017

@mistercrunch is it alright if I just move the logic into a separate function? Redirecting to /explore_json/<datasource_type>/<datasource_id> from /slice/<slice_id>/query/ would mean calling get_viz a second time, which makes another database call.

@Mogball
Copy link
Contributor Author

Mogball commented Sep 22, 2017

As for the use case: we want to be able to plug the generated query into other systems.

@Mogball Mogball force-pushed the mogball/feature/query_apiendpoint branch from 79fc065 to 7fa4137 Compare September 22, 2017 19:41
@Mogball Mogball closed this Sep 22, 2017
@Mogball Mogball reopened this Sep 22, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 69.879% when pulling 7fa4137 on Mogball:mogball/feature/query_apiendpoint into 255ea69 on apache:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 69.879% when pulling 7fa4137 on Mogball:mogball/feature/query_apiendpoint into 255ea69 on apache:master.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.3%) to 69.879% when pulling 7fa4137 on Mogball:mogball/feature/query_apiendpoint into 255ea69 on apache:master.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.3%) to 69.879% when pulling 7fa4137 on Mogball:mogball/feature/query_apiendpoint into 255ea69 on apache:master.

@api
@has_access_api
@expose("/slice/<slice_id>/query/")
def sliceQuery(self, slice_id):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: slice_query

@Mogball Mogball closed this Sep 26, 2017
@Mogball Mogball reopened this Sep 26, 2017
@coveralls
Copy link

coveralls commented Sep 26, 2017

Coverage Status

Coverage increased (+0.4%) to 69.896% when pulling a1a0428 on Mogball:mogball/feature/query_apiendpoint into 255ea69 on apache:master.

@mistercrunch mistercrunch merged commit 7d934e7 into apache:master Sep 26, 2017
timifasubaa pushed a commit to timifasubaa/incubator-superset that referenced this pull request Oct 3, 2017
* exposed API endpoint to get querystring for a slice

* Added unit tests for endpoint

* fixed test case for python3

* moved get querystring logic into its own func

* renamed query string endpoint
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
* exposed API endpoint to get querystring for a slice

* Added unit tests for endpoint

* fixed test case for python3

* moved get querystring logic into its own func

* renamed query string endpoint
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.20.1 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.20.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants