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

[sqllab] add support for results backends #1377

Merged
merged 5 commits into from
Oct 21, 2016

Conversation

mistercrunch
Copy link
Member

@ascott @vera-liu @bkyryliuk
Long running SQL queries (beyond the scope of a web request) can now use
a k/v store to hold their result sets.

img

Side missions:

  • Use redux-thunk for async query processing
  • Added a data preview option for queries that ran async
  • Data preview for any table element in the left panel
  • Make a bunch of components more flexible to satisfy the use-cases here

Copy link
Member

@bkyryliuk bkyryliuk left a comment

Choose a reason for hiding this comment

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

Great velocity !
I've left couple comments.

dataType: 'json',
url: sqlJsonUrl,
success(results) {
// console.log(results);
Copy link
Member

Choose a reason for hiding this comment

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

delete this

dispatch(querySuccess(query, results));
},
error() {
// console.log(err);
Copy link
Member

Choose a reason for hiding this comment

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

ditto

sql: query.sql,
sql_editor_id: query.sqlEditorId,
tab: query.tab,
// tmp_table_name: this.state.ctas,
Copy link
Member

Choose a reason for hiding this comment

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

add a todo to fix it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh right! I never finished that part

// console.log(results);
dispatch(querySuccess(query, results));
},
error() {
Copy link
Member

Choose a reason for hiding this comment

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

s/error/error(err, textStatus, errorThrown) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's ok to just notify of the failure without the underlying details

}
},
error(err, textStatus, errorThrown) {
let msg;
Copy link
Member

Choose a reason for hiding this comment

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

it would be great to have this method in the utils. optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I had the same feeling that we should generalize that somehow, we're supposed to start using fetch instead of jquery, maybe then would be a good time

@@ -1964,6 +1964,38 @@ def cached_key(self, key):
return "nope"

@has_access_api
@expose("/results/<key>/")
@log_this
def results(self, key):
Copy link
Member

Choose a reason for hiding this comment

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

if we'll have key as a query_name + timestamp we would be able to tell the user if the result set was expired

obj = json.loads(json_payload)
db_id = obj['query']['dbId']
session = db.session()
mydb = session.query(models.Database).filter_by(id=db_id).first()
Copy link
Member

Choose a reason for hiding this comment

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

s/first()/one()
it will fail if the DB was removed and will provide meaningful error message


return Response(
json_payload,
status=202,
Copy link
Member

Choose a reason for hiding this comment

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

s/202/200 ?
processing completed at this stage

"re-run the query."
)
}),
status=202,
Copy link
Member

Choose a reason for hiding this comment

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

s/202/410 ?
The requested resource is no longer available at the server and no forwarding address is known.

mimetype="application/json")
else:
return Response(
json.dumps({
Copy link
Member

Choose a reason for hiding this comment

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

s/json_dumps/json_error_response("Data could not be retrived. You may want to re-run the query", status=410)

@mistercrunch
Copy link
Member Author

Thanks for the thorough review, I think I addressed and/or commented on all the comments.

import ResultSet from './ResultSet';

const propTypes = {
queries: React.PropTypes.array,
Copy link
Member Author

Choose a reason for hiding this comment

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

object

@bkyryliuk
Copy link
Member

🚢

Long running SQL queries (beyond the scope of a web request) can now use
a k/v store to hold their result sets.
@mistercrunch mistercrunch merged commit 6fb3b30 into apache:master Oct 21, 2016
@mistercrunch mistercrunch deleted the results_backends branch October 21, 2016 06:40
neevany pushed a commit to Kieraya/caravel that referenced this pull request Oct 24, 2016
* [sqllab] add support for results backends

Long running SQL queries (beyond the scope of a web request) can now use
a k/v store to hold their result sets.

* Addressing comments, fixed js tests

* Fixing mysql has gone away

* Adressing more comments

* Touchups
@@ -37,16 +39,18 @@ class App extends React.Component {
</div>
);
}
content = (
Copy link
Contributor

Choose a reason for hiding this comment

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

I realized content here gets reassigned when this.state.hash is true, so QuerySearch page is not shown, is this intended? @mistercrunch

zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.12.0 labels Feb 19, 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.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants