I am having phyton code in 10 databricks cell in a single databricks notebook.
The first cell contains the below code.
df = spark.sql(f"""select * from test.table """)
count= df.count()
Here if count is 0 , I want the notebook to fail, if the count is greater than 1 , I want the rest of the cells in the databricks notebook to execute.
Im trying the below code.
df = spark.sql(f"""select * from test.table """)
count= df.count()
assert count <= 0
The above code is not raising an assertion error, instead it just says query returns no results and executes the next cell in the databricks. Could someone please let me know to raise an assert exception and terminate the notebook without execution further cells.
Thank you.