I need to retain say last 7 partitions and data of a given hive external table.
This can be either done via a shell script or a hive hql script. The table is partitioned by intgestion_date=YYYY-MM-DD
what would be the best way to find the cutoff date (of 7th partition) which I can then use in the drop partitions where clause to drop everything older than that. since it's an external table, I will have to change the table properties to make it internal before the drop and then revert it.