Skip to content
Advertisement

Python: How to move files in a structured folder based on year/month/date format?

Currently I have a spark job that reads the file, creates a dataframe, does some transformations and then move those records in “year/month/date” format. I am achieving this by:

JavaScript

I want to achieve the same by pythonic way. So, in the end it should look like:

JavaScript

Advertisement

Answer

Based on your question , instead of using partitionBy you can also modify your config['destination'] , as s3 will take care of the necessary folder creations underneath the s3 path

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement