You are trying to export notebooks using the workspace UI and are getting an error message.
This item was too large to export. Try exporting smaller or fewer items.
The notebook files are larger than 10 MB in size.
The simplest solution is to limit the size of the notebook or folder that you are trying to download to 10 MB or less. If it is smaller than 10 MB in size, you can download it via the workspace UI.
If the notebook or folder is larger than 10 MB in size, you should use the Databricks CLI (AWS | Azure | GCP) to export the contents.
This example code exports all notebooks and folders in a workspace to a folder on your local machine.
Make sure you create a workspace profile in the CLI before attempting to run this sample code.
- Copy the example code to your local machine as a Python file (ex. export-notebook.py).
import sys import os import subprocess from subprocess import call, check_output EXPORT_PROFILE = "primary" # Get a list of all users. user_list_out = check_output(["databricks", "workspace", "ls", "/Users", "--profile", EXPORT_PROFILE]) user_list = (user_list_out.decode(encoding="utf-8")).splitlines() print (user_list) # Export folders and notebooks for each user. # Note: This does not include libraries. for user in user_list: print (("Trying to migrate workspace for user ") + user) subprocess.call(str("mkdir -p ") + str(user), shell = True) export_exit_status = call("databricks workspace export_dir /Users/" + str(user) + " ./" + str(user) + " --profile " + EXPORT_PROFILE, shell = True) if export_exit_status==0: print ("Export Success") else: print ("Export Failure") print ("All done")
- Run the sample code under Python 3.
- The notebooks and folders from your workspace are downloaded to the local folder where you ran the example code.