how to get dbutils in Runtime 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 05:54 AM
We're using the following method (generated by using dbx) to access dbutils, e.g. to retrieve parameters from secret scopes:
@staticmethod
def _get_dbutils(spark: SparkSession) -> "dbutils":
try:
from pyspark.dbutils import DBUtils # type: ignore
if "dbutils" not in locals():
utils = DBUtils(spark)
return utils
else:
return locals().get("dbutils") # type: ignore
except ImportError:
return None # type: ignore
However, I discovered when running on Databricks Runtime 13 that this no longer works.
I checked release notes for 13, but saw nothing relevant.
How can we access dbutils in library code in runtime 13?
- Labels:
-
Databricks Runtime
-
Dbutils
-
Secret Scopes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2023 04:45 PM
Hi, please use a Machine Learning DBR (Databricks Runtime X.Y for Machine Learning) that comes with DBUtils preinstalled:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 07:50 AM
We have something similar in our code. This worked using runtime 13 until last week. Also the Machine Learning DBR doesn't work either.

