cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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
New Contributor II

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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.