I have created a Glue job that copies data from S3 (csv file) to Redshift.  It works and populates the desired table.
However, I need to purge the table during this process as I am left with duplicate records after the process completes.
I'm looking for a way to add this purge to the Glue process.  Any advice would be appreciated.
Thanks.
The link @frobinrobin provided is out of date, and I tried many times that the preactions statements will be skiped even you provide a wrong syntax, and came out with duplicated rows(insert action did executed!)
Try this:
just replace the syntax from
glueContext.write_dynamic_frame.from_jdbc_conf() in the link above to glueContext.write_dynamic_frame_from_jdbc_conf() will works!
At least this help me out in my case(AWS Glue job just insert data into Redshift without executing Truncate table actions)
AWS Glue Truncate Redshift Table