dstandish commented on a change in pull request #16821:
URL: https://github.com/apache/airflow/pull/16821#discussion_r665031254
##########
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:
does not handle case where you have exactly _one of_ `to_datetime` and
`start_after_datetime` (i.e. not both)
also pendulum and datetime are formatted differently. observe:
```python
>>> import pendulum
>>> '{}'.format(pendulum.now())
'2021-07-06T21:22:11.514220-07:00'
>>> from datetime import datetime
>>> '{}'.format(datetime.now())
'2021-07-06 21:22:35.418199'
```
if you compare the objects directly, your feature could support both
pendulum _(which is used commonly with airflow)_ and datetime; but by using
string formatting you really cannot use both.
--
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]