title: Call dbutils.notebook.exit() from a sql notebook
body: <p>I'm fairly new to databricks and I have a query.</p>
  <p>I have a schedule job which calls a sql notebook</p>
  <pre><code>`try:
      dbutils.notebook.run(&quot;/01. SMETS1Mig/&quot; + dbutils.widgets.get(&quot;env_parent_directory&quot;) + &quot;/02 Processing Curated Staging/02 Build - Parameterised/MMT Processing - Migration Selection&quot;, 6000, {
          &quot;env_ingest_db&quot;: dbutils.widgets.get(&quot;env_ingest_db&quot;)
        , &quot;env_stg_db&quot;: dbutils.widgets.get(&quot;env_stg_db&quot;)
        , &quot;env_tech_db&quot;: dbutils.widgets.get(&quot;env_tech_db&quot;)
        })
  except Exception as error:
  # 611 Start  
  #    print
      sys.exit('Failure in MMT Processing - Migration Selection ({error})')
  # 611 End`
  </code></pre>
  <p>The sql notebook has about 30 cmd cells doing various task. I'd like to add a cmd cell at the top which if the result is 0 then it exits the notebook and fails the job. The new cmd could use the following logic</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT count(1) 
  FROM $env_tech_db.tbl_tech_daily_demand_import ddi 
  WHERE string(ddi.week_starting) = rtrim((
           SELECT value 
           FROM $env_tech_db.tbl_tech_admin_data WHERE type = 'Selection_Week' )) 
  AND author = 'DCC';
  
  </code></pre>
  <p>I've been reading about the dbutils.notebook.exit, but just confused as hell. Is there an easy way to do what I'm asking. I'm only allowed use sql or python</p>
  <p>Thanks in advance</p>