ferruzzi commented on code in PR #39151: URL: https://github.com/apache/airflow/pull/39151#discussion_r1575404547
########## 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: > there are specific tests that check what happens for empty list or string in keys value Yeah I saw those, I just disagree with how they were handled, but that's way out of scope for this PR. If an empty value is acceptable, then it's clearly NOT a required value. But either way, not something to fix here. Sorry about that. > do you suggest to add the exactlyone function to airflow helpers? If you feel like doing it, I'd support that, but I won't require it. This statementis correct as written but really isn't intuitive at all, and that's usually when I start looking for a helper to clarify. We already have `exactly_one` and `at_most_one`, it makes sense ti add `at_least_one`. Feel free to resolve this convo. -- 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