cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to write json in file in s3 directly in python?

Kaniz
Community Manager
Community Manager
 
1 ACCEPTED SOLUTION

Accepted Solutions

Ryan_Chynoweth
Honored Contributor III

Assuming that the S3 bucket is mounted in the workspace you can provide a file path.

If you want to write a PySpark DF then you can do something like the following:

df.write.format('json').save('/path/to/file_name.json')

You could also use the json python library but this would be non-pyspark code.

View solution in original post

2 REPLIES 2

Ryan_Chynoweth
Honored Contributor III

Assuming that the S3 bucket is mounted in the workspace you can provide a file path.

If you want to write a PySpark DF then you can do something like the following:

df.write.format('json').save('/path/to/file_name.json')

You could also use the json python library but this would be non-pyspark code.

Thank you so much @Ryan Chynowethโ€‹ .

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.