Python Databricks how to run all cells in another notebook except the last cell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 11:04 AM
I have a Python Databricks notebook which I want to call/run another Databricks notebook using dbutils.notebook.run()... but I want to run all the cells in the "called" notebook except the last one.
Is there a way to do a count of cells in the called notebook? And then run the called notebook on all cells until CellCount-1 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 11:39 AM
I don't think this is possible. You can only complete a notebook.
BTW curious to know what is the use-case here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 05:53 PM
In the alternative way, you can use dbutils.notebook.run to pass the parameters, and use dbutils.widgets.get in another notebook to get the parameter values,
and determine the parameter values to decide whether to execute codes in the specified cell
https://docs.databricks.com/en/notebooks/notebook-workflows.html#example

