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: 

Put file into volume within Databricks

lauraxyz
New Contributor III

Hi!  From a Databricks job, i want to copy a workspace file into volume.  how can i do that?

I tried

`dbutils.fs.cp("/Workspace/path/to/the/file", "/Volumes/path/to/destination")`
but got 
Public DBFS root is disabled. Access is denied on path: /Workspace/path/to/the/file
 
Is this the recommended way to put file into Volume?  prefer not to go with the API way for now.

 

4 REPLIES 4

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @lauraxyz,

You can give it a try using: dbutils.fs.cp("file:/Workspace/path/to/the/file", "/Volumes/path/to/destination")

by adding "file:", i'm able to put File type into Volume, but for Notebook type, i would get following error:

ExecutionError: An error occurred while calling o460.cp. : java.io.FileNotFoundException: /Workspace/path/to/the/file (Operation not supported)

How does it work for Notebook type of file? I tried replace "file:" with "notebook:" or "Notebook:", neither works

Alberto_Umana
Databricks Employee
Databricks Employee

Let me try it on my end and get back, looks like we need to upload the destination location to a dbfs location first then a volumen.

lauraxyz
New Contributor III

Found the reason!  It's the runtime, it doesn't work on Databricks Runtime Version 15.4 LTS, but started to work after changing to 16.0.   Maybe this is something supported from the latest version?

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