cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get dbutils in Runtime 13

grazie
Contributor

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?

2 REPLIES 2

User16463165548
Databricks Employee
Databricks Employee

Hi, please use a Machine Learning DBR (Databricks Runtime X.Y for Machine Learning) that comes with DBUtils preinstalled:

Databricks Runtime 13.0 for Machine Learning

colt
New Contributor III

We have something similar in our code. This worked using runtime 13 until last week. Also the Machine Learning DBR doesn't work either.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group