Hi @Nolan Lavenderโ , For e.g. if want to stop streaming on Saturday, you could do something like the below. Below is just a pseudo code.
.foreachBatch{ (batchDF: DataFrame, batchId: Long) =>
if (date_format(current_timestamp(), "u") == 6) { //run commands to maintain the table }
Alternatively, You can calculate approximately how many micro batches are processed in a week and then you can periodically stop the streaming job. If your streaming is processing 100 microbatches in a week, then you can do something like below.
.foreachBatch{ (batchDF: DataFrame, batchId: Long) =>
if (batchId % 101 == 0) { //run commands to maintain the table }