Help regarding a python notebook and s3 file structure

lecarusin
New Contributor II

Hello all, I am new to this forum, so please forgive if I am posting in the wrong location (I'd appreciate if the post is moved by mods or am told where to post).

I am looking for help with an optimization of a python code I have. This python notebook I have a version that  currently runs in AWS Glue, and has a logic that helps me deal with the data, which has the following structure:
bucket/bronze/sap/holding/{company_name}*/jdt1/{year}/{month}/{day}/file.json
*29 total

The problem I have is that in Glue I can make it so, as an incremental load, I filter by latest 90 days and those dates are the only ones that are searched for. In what I managed to do in databricks, however, it always read all the files and then it filters the dataframe generated by those files. I want to know how can I make it so it reads only the latest 90 days, for example:
- Start: bucket/bronze/sap/holding/{company_name}*/jdt1/2025/09/01/file.json
- End: bucket/bronze/sap/holding/{company_name}*/jdt1/2025/12/30/file.json

This would be done for all the companies that exist. Anyone can tell me how to make a logic that reads only the files of said dates instead of the whole thing? Thanks