Skip to content

Instantly share code, notes, and snippets.

@Zifah
Last active February 9, 2019 20:28
Show Gist options
  • Save Zifah/2a9c7b26b5925fe9ca3b080f6c3faefa to your computer and use it in GitHub Desktop.
Save Zifah/2a9c7b26b5925fe9ca3b080f6c3faefa to your computer and use it in GitHub Desktop.
Write a Spark dataframe to an Azure blob storage container mounted on Databricks filesystem
mount_name = "/mnt/financial_survey_data"
write_path = "%s/wrangled_data_folder" % mount_name
(dataframe
# .coalesce(1) # uncomment this line to ensure that the data is written to just one file
.write
.option("header", "true")
.mode("overwrite") # overwrite any pre-existing data at the path that we're writing to
.csv(write_path)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment