kanga333 commented on a change in pull request #9350:
URL: https://github.com/apache/airflow/pull/9350#discussion_r441908023
##########
File path: airflow/providers/amazon/aws/operators/s3_delete_objects.py
##########
@@ -56,22 +59,34 @@ class S3DeleteObjectsOperator(BaseOperator):
:type verify: bool or str
"""
- template_fields = ('keys', 'bucket')
+ template_fields = ('keys', 'bucket', 'prefix')
@apply_defaults
def __init__(
self,
bucket,
- keys,
+ keys=None,
+ prefix=None,
aws_conn_id='aws_default',
verify=None,
*args, **kwargs):
+
+ if not keys and not prefix:
+ raise ValueError("Either keys or prefix should be set. Both are
None")
Review comment:
Thanks for your review.
I missed the possibility of an empty array in the keys. When an empty array
is passed to the keys, S3DeleteObjectsOperator does nothing without raising an
exception. I'm going to compare the condition to None in order to not change
this behavior.
```python
if keys is None and prefix is None:
```
I'm also going to add a simple test to confirm this behavior.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]