Is there a way to catch the cancel button or the interrupt button in a Databricks notebook?

Jfoxyyc
Valued Contributor

I'm running oracledb package and it uses sessions. When you cancel a running query it doesn't close the session even if you have a try catch block because a cancel or interrupt issues a kill command on the process. Is there a method to catch the cancel or interrupt? In an ipynb notebook I could use except KeyboardInterrupt.