- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 04:19 AM
How to mock a code that uses dbutils from
"from databricks.sdk.runtime import dbutils"
it shows databricks-sdk has no attribute runtime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 09:37 PM
Hi @samarth_solanki , I Hope you are doing well!
Based on the information you have shared, it seems like you're trying to import dbutils from databricks.sdk.runtime, but you're encountering an error that says "databricks-sdk has no attribute runtime".
This issue might be due to the incorrect import statement or the version of the Databricks SDK you're using. To use dbutils with the Databricks SDK for Python is to call it from the WorkspaceClient. Kindly refer to this as a example:
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
d = w.dbutils.fs.ls('/')
for f in d:
print(f.path)
If you still face the issue then I would suggest checking the latest version of the Databricks SDK you are using and you can upgrade to the latest version using the below command:
%pip install databricks-sdk --upgrade
Please refer this document for the more details: https://docs.databricks.com/ja/dev-tools/sdk-python.html#use-databricks-utilities
Please let me know if this helps and leave a like if this information is useful, followups are appreciated.
Kudos
Ayushi