-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
SQL Lab queries can't be stopped #17011
Comments
Hi @ValentinC-BR, when you say nothing happens when you hit the stop button, if you look in your network tab, is your browser making the call to the |
Ok, interesting. Do you have access to your logs to see what the error was? We were able to reproduce with Athena, and are looking more into this. |
I have noticed this as well. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue |
Was it fixed in the latest release ? |
@eschutho I have also observed same behavior with Athena. I was not able to stop one of my Athena queries. On clicking stop button i get error "Failed at stopping query." Here are few logs: |
Cancel query has only been implemented for mysql, postgres, and snowflake. Thus the error that you're seeing on Athena. It's a fairly simple integration needed where you would run that sql statement that you ran directly above. Here's an example for Mysql if someone is interested in contributing this fix: https://github.com/preset-io/superset/blob/02032ee8a478ab9578cf6e13a7645a8b4106be58/superset/db_engine_specs/mysql.py#L240 |
@eschutho I ran query against Superset metadata databases's query table. |
@mdeshmu correct on all points. Ok, let's see if they have any answers for that lookup. Also I found this if it helps: https://github.com/laughingman7743/PyAthena/blob/master/pyathena/cursor.py#L65 |
@eschutho In case of Athena, we will have to get QueryExecutionId after running sql statements. So this code won't help us since it is run before the query execution. Looking at this reply, I understand that the cursor.execute method blocks until the query execution is finished. So probably we need some kind of multi-threading to capture QueryExecutionId. |
Correct. The cancel query action is executed here so it will run in a separate thread. If you know how to get the QueryExecutionId, we'll need to add to the Athena db_engine_spec these two methods: get_cancel_query_id and cancel_query |
Here's an example of a recent PR to add the cancel functionality to Redshift for reference: #16326 |
@eschutho What i meant is, To capture QueryExecutionId, we would need a separate thread utilizing the same cursor that is used for running sql statements from SQL Lab but current location of invocation of get_cancel_query_id wouldn't give us QueryExecutionId because its invoked before execution of SQL statements. Even if we move this after execution of SQL statements then also its of no use as cursor would be blocked until the query execution is finished and get_cancel_query_id would be called after query execution has finished, hence of no use. Please correct me if I am wrong. |
So this is the abbreviated code for the whole flow of running a query to stopping it. It should work with Athena as long as we build out the two required methods
(separate thread after clicking the "STOP" button)
|
@eschutho In Athena, query id is not available immediately after initiation of cursor.
|
In pyAthena in version 1.11 we can cancel a query in cursor. Actually superset use pyAthena 1.10 |
@jplanckeel Superset works with latest PyAthena version. It seems you are referring to query cancellation on KeyboardInterrupt. Can you explain how it can be applied in this case? |
Thanks for starting a PR @jplanckeel. We'll review or give feedback when ready. |
Hey all... I know that some DBs made progress in this area, but I'm not sure about Athena. Since the PR is not moving forward, and this thread has been silent for about a year and a half, I wondered if y'all think we should keep this open, or let it go. In particular, since it's arguably a feature request as much as a bug ¯\_(ツ)_/¯ |
I'm not directly affected any longer, as we moved to Snowflake. I would definitely not call it a feature, since users expect the STOP button in SQLLab to work. |
Hey folks! Any news about this issue? It's still happening here with Athena. |
@ajunior if you (or anyone reading this) want to pick up the abandoned PR, you may be able to fix it. We'd appreciate the contribution! |
Possible to assign me? I will have a look. @rusackas |
@vyasmanmohan thanks for stepping up! I've assigned the issue to you, though I can't assign the PR. If you want me to assign that, too, you need to comment on that thread as well. |
Any word on this @vyasmanmohan ? If nobody on the thread is working on this, we might close it out as stale/abandoned to maintain a more actionable backlog. |
When a SQL query is running is SQL Lab, it can't be stopped.
How to reproduce the bug
Expected results
The query should be stopped
Actual results
The query is still running
Screenshots
(Imagine a query running in the SQL Lab...)
Environment
(please complete the following information):
Checklist
Make sure to follow these steps before submitting your issue - thank you!
Additional context
The queries could be stopped in Superset v1.1
The text was updated successfully, but these errors were encountered: