ibexy
ibexy

Reputation: 611

How do I copy a local file to Azure Databricks DBFS filestore

I am using the below command in Azure Databricks to try and copy the file test.csv from the local C: drive to the Databricks dbfs location as shown.

dbutils.fs.cp("C:/BoltQA/test.csv", "dbfs:/tmp/test_files/test.csv")

I am getting this error:

java.io.IOException: No FileSystem for scheme: C
---------------------------------------------------------------------------
ExecutionError                            Traceback (most recent call last)
<command-3936625823332356> in <module>
----> 1 dbutils.fs.cp("C:/test.csv", "dbfs:/tmp/test_files/test.csv")
      2 

/local_disk0/tmp/1605164901540-0/dbutils.py in f_with_exception_handling(*args, **kwargs)
    312                     exc.__context__ = None
    313                     exc.__cause__ = None
--> 314                     raise exc
    315             return f_with_exception_handling
    316 

Help please.

Upvotes: 4

Views: 28009

Answers (1)

Vhota
Vhota

Reputation: 11

The local files can be recognised with file://... so make a change to the command similar to below

dbutils.fs.cp("file://c:/user/file.txt",<container path>)

Upvotes: 1

Related Questions