How to delete a Parquet file on Spark?

13,559

This parquet "file" will actually be a directory. This answer shows how to delete a directory with files in it

import shutil
shutil.rmtree('/folder_name')
Share:
13,559
Admin
Author by

Admin

Updated on August 21, 2022

Comments

  • Admin
    Admin over 1 year

    I have saved a parquet file on Spark using DataFrame.saveAsParquet() command.

    How can I delete/remove this file via python code?

  • Admin
    Admin almost 8 years
    It works without the forward slash. shutil.rmtree('folder_name')
  • bsplosion
    bsplosion over 4 years
    Note that this only works on the OS and is not applicable on HDFS, S3, or myriad other common locations for Parquet files being used in Spark.