Databricks is smart and all, but how do you identify the path of your current notebook? The guide on the website does not help.
It suggests:
%scala
dbutils.notebook.getContext.notebookPath
res1: Option[String] = Some(/Users/[email protected]/my_test_notebook)
This does not give me the complete path, but rather the path to some folder structure that is not accessible from the notebook. I need the path, such that I can make system calls in the same folder as the .ipynb file.
Any suggestions?
To specify a relative path, preface it with ./ or ../. For example, if notebookA and notebookB are in the same directory, you can alternatively run them from a relative path.
ls command (dbutils.fs.ls)Lists the contents of a directory. To display help for this command, run dbutils.
The Databricks File System (DBFS) is a distributed file system mounted into an Azure Databricks workspace and available on Azure Databricks clusters.
You can retrieve the information by using dbutils command:
dbutils.notebook.entry_point.getDbutils().notebook().getContext().notebookPath().get()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With