idantepper commented on code in PR #39151:
URL: https://github.com/apache/airflow/pull/39151#discussion_r1575341888


##########
airflow/providers/amazon/aws/operators/s3.py:
##########
@@ -503,23 +509,37 @@ def __init__(
         self.bucket = bucket
         self.keys = keys
         self.prefix = prefix
+        self.from_datetime = from_datetime
+        self.to_datetime = to_datetime
         self.aws_conn_id = aws_conn_id
         self.verify = verify
 
         self._keys: str | list[str] = ""
 
-        if not exactly_one(prefix is None, keys is None):
-            raise AirflowException("Either keys or prefix should be set.")
+        if not exactly_one(keys is None, all([prefix is None, from_datetime is 
None, to_datetime is None])):
+            raise AirflowException(
+                "Either keys or at least one of prefix, from_datetime, 
to_datetime should be set."

Review Comment:
   I agree that it will be easier to understand without the negative sections.
   do you suggest to add the exactlyone function to airflow helpers?
   The statement checks if keys are given or at least one of the other params 
were given.
   it could be only the keys or any combination that includes one of the other 
params
   
   about empty list or empty string they are both valid options for keys, maybe 
someone has this operator in a dag that gets dynamically which keys to delete 
but for a specific run he didn't have any keys to delete so the value of keys 
will be the empty list and the action that will be performed is to not delete 
any key
   



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to