cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unable to read available file after downloading

sharma_kamal
New Contributor III

After downloading a file using `wget`, I'm attempting to read it by spark.read.json.

I am getting error:
 
PATH_NOT_FOUND - Path does not exist: dbfs:/tmp/data.json. SQLSTATE: 42K03
File <command-3327713714752929>, line 2
 
I have checked the file do exist. I attempted to copy the file to DBFS, but encountered difficulties.
Attaching relevant screenshots here.  

Could someone please help me identify any errors or issues in my approach?

Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions

ThomazRossito
Contributor

Hi, 

Perform a test with the code below


Code layout:
dbutils.fs.cp
("file:///<file source directory>/<your file extension>""dbfs:/<file destination directory>/", True)
 
Code example:
dbutils.fs.cp("file:///tmp/file.csv", "dbfs:/tmp/"True)
Att.
Thomaz Antonio Rossito Neto
Data Technical Lead / Data Engineer-Architect

View solution in original post

3 REPLIES 3

ThomazRossito
Contributor

Hi, 

Perform a test with the code below


Code layout:
dbutils.fs.cp
("file:///<file source directory>/<your file extension>""dbfs:/<file destination directory>/", True)
 
Code example:
dbutils.fs.cp("file:///tmp/file.csv", "dbfs:/tmp/"True)
Att.
Thomaz Antonio Rossito Neto
Data Technical Lead / Data Engineer-Architect

Thank you. It worked!

Ayushi_Suthar
Honored Contributor
Honored Contributor

Hi @sharma_kamal , Good Day! 

Could you please try the below code suggested by @ThomazRossito , it will help you. 

Also please refer to the below document to work with the files on Databricks: 

https://docs.databricks.com/en/files/index.html

Please let me know if this helps and leave a like if you find this information useful. Follow-ups are appreciated.
Kudos
Ayushi

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!