Hello Kauan, I've been working in a solution that might be close to what you need.
Here i'm using a query to import the dbConnector by Custom Code. This code compare the date column of the database "Arrivals" (that is in Excel format in this case) whitin the current Model Time and pulls just 1 week of data to GlobalTable1.
Database.Connection dbConn = Database.Connection("db_Historic");
//Query pulls and order the Arrivals in interval of 7 days based on Model DateTime
dbConn.query("SELECT * FROM input_2022 WHERE Arrivals BETWEEN " + string.fromNum(Model.dateTime.excelTime) + " AND " + string.fromNum(Model.dateTime.excelTime + 7) + " ORDER BY Arrivals ASC").cloneTo("GlobalTable1");
By that you can execute this code as many times you need and decrease your model's weight. Depending on your database time format you might need to use other functions of Model.dateTime to adapt the query.