cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Community Platform 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:ย 

File not found error when trying to read json file from aws s3 using with open.

Nagarathna
New Contributor II

I am trying to reading json from aws s3 using with open in databricks notebook using shared cluster.

Error message:No such file or directory:'/dbfs/mnt/datalake/input_json_schema.json'

In single instance cluster the above error is not found.

 

 

3 REPLIES 3

artsheiko
Honored Contributor

Hey,

Please consider to use Unity Catalog with Volumes.

You'll find a quickstart notebook here : https://docs.databricks.com/en/connect/unity-catalog/volumes.html#tutorial-unity-catalog-volumes-not... 

Hope it helps,

Best,

Nagarathna
New Contributor II

Hey,

Thanks for suggesting this approach.

But I want to know why the json file cannot be read from AWS S3 bucket using "with open" in python with shared instance mode cluster. 

The code works perfectly fine if I'm using a single instance mode cluster.

code:

with open("/dbfs/mnt/datalake/input.json","r") as f:

         data = f.read()

NandiniN
Honored Contributor

Hi @Nagarathna ,

I just tried it on a shared cluster and did not face any issue. What is the exact error that you are facing? Complete stacktrace might help. Just to confirm are you accessing the "/dbfs/mnt/datalake/input.json" from the same workspace when trying out the cluster modes?

Thanks!

Screenshot 2024-05-01 at 15.34.30.png

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