Hubert-Dudek
Databricks MVP

Code without collect, which should not be used in production:

if df.filter("count > 0").count() > 0: dbutils.notebook.exit('Notebook Failed')

you can also use a more aggressive version:

if df.filter("count > 0").count() > 0: raise Exception("count bigger than 0")


My blog: https://databrickster.medium.com/