I have a databricks data frame called df. I want to write it to a S3 bucket as a csv file. I have the S3 bucket name and other credentials. I checked the online documentation given here https://docs.databricks.com/spark/latest/data-sources/aws/amazon-s3.html#mount-aws-s3 and it says to use following commands
dbutils.fs.mount(s"s3a://$AccessKey:$SecretKey@$AwsBucketName", s"/mnt/$MountName", "sse-s3")
dbutils.fs.put(s"/mnt/$MountName", "<file content>")
But what I have is a dataframe and not a file. How can I achieve it?
df.write.csv('/mnt/mountname/filename.csv')or for more options see spark.apache.org/docs/latest/…