how to cancel or kill a long running sql query from databricks python notebook.I have a long running

slakshmanan
New Contributor III

how to cancel or kill a long running sql query from databricks python notebook.I have a long running sql query in sql warehouse

szymon_dybczak
Esteemed Contributor III

Hi @slakshmanan ,

To stop or interrupt a running notebook, select the interrupt button in the notebook toolbar. You can also select Run > Interrupt execution, or use the keyboard shortcut I I.

https://learn.microsoft.com/en-us/azure/databricks/notebooks/run-notebook

And if you're going to use SQL warehouse then to terminate a long-running query started by you or another user:

  1. View query history.

  2. Click the name of a query.

  3. Next to Status, click Cancel.

https://docs.databricks.com/en/sql/user/queries/query-history.html#terminate-an-executing-query

Interrupt button looks like below:

szymon_dybczak_0-1728442814226.png

 

i want to stop it from rest api call or from an python code runnining in databricks to kill long running sql query from warehouse

szymon_dybczak
Esteemed Contributor III

I don't think that exist such an endpoint yet. At least, I couldn't find it in documentation.