-
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
[sqllab] add support for results backends #1377
Conversation
There was a problem hiding this 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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) ?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
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)
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object
🚢 |
Long running SQL queries (beyond the scope of a web request) can now use a k/v store to hold their result sets.
f9d73dc
to
6d51dc5
Compare
224b9b9
to
7edfaa5
Compare
* [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 = ( |
There was a problem hiding this comment.
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
@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.
Side missions: