dstandish commented on a change in pull request #16821:
URL: https://github.com/apache/airflow/pull/16821#discussion_r668288116



##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -292,18 +302,24 @@ def list_keys(
             'PageSize': page_size,
             'MaxItems': max_items,
         }
-
         paginator = self.get_conn().get_paginator('list_objects_v2')
         response = paginator.paginate(
-            Bucket=bucket_name, Prefix=prefix, Delimiter=delimiter, 
PaginationConfig=config
+            Bucket=bucket_name,
+            Prefix=prefix,
+            Delimiter=delimiter,
+            PaginationConfig=config,
+            StartAfter=start_after_key,
+        )
+        # JMESPath to query directly on paginated results
+        filtered_response = response.search(
+            "Contents[?to_string("
+            "LastModified)<='\"{}\"' && "
+            "to_string(LastModified)>='\"{"

Review comment:
       i'm not sure i like the ResponsFilter approach.
   
   if you want to use the `object_filter` approach, why not just let the user 
put an arbitrary callable that does the filtering that the user needs.  e.g. 
`lambda x: x['LastModified'] > some_val`. or `lambda x: other_val > 
x['LastModified'] > some_val`
   
   to me this seems much simpler to implement (cus it removes the entire 
ResponseFilter` class) and quite simple and transparent to use.
   
   i am not sure we need to add this abstraction layer -- that's just another 
thing to have to learn.
   
   alternatively, i would be fine doing `from_datetime` and `to_datetime` where 
from is evaluated `>=` and to is evaluated `<`
   
   what do yall think?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to