Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generated/known_airflow_exceptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ providers/amazon/src/airflow/providers/amazon/aws/operators/neptune.py::4
providers/amazon/src/airflow/providers/amazon/aws/operators/rds.py::4
providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_cluster.py::9
providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_data.py::2
providers/amazon/src/airflow/providers/amazon/aws/operators/s3.py::5
providers/amazon/src/airflow/providers/amazon/aws/operators/s3.py::4
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py::22
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker_unified_studio.py::2
providers/amazon/src/airflow/providers/amazon/aws/operators/step_function.py::2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,12 @@ def __init__(

self._keys: str | list[str] = ""

if not exactly_one(keys is None, all(var is None for var in [prefix, from_datetime, to_datetime])):
raise AirflowException(
# Checked here and again in execute(): this guard keeps a plain authoring mistake a
# parse-time error, while execute() catches a templated `keys` that renders to None
# (which would otherwise list — and delete from — the whole bucket).
by_scan = prefix is not None or from_datetime is not None or to_datetime is not None
if not exactly_one(keys is not None, by_scan):
raise ValueError(
"Either keys or at least one of prefix, from_datetime, to_datetime should be set."
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ def test_s3_delete_empty_string(self):
)
def test_validate_keys_and_filters_in_constructor(self, keys, prefix, from_datetime, to_datetime):
with pytest.raises(
AirflowException,
ValueError,
match=r"Either keys or at least one of prefix, from_datetime, to_datetime should be set.",
):
S3DeleteObjectsOperator(
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/prek/validate_operators_init_exemptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ providers/amazon/src/airflow/providers/amazon/aws/operators/emr.py::EmrAddStepsO
providers/amazon/src/airflow/providers/amazon/aws/operators/glue.py::GlueDataQualityOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/neptune.py::NeptuneStartDbClusterOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/neptune.py::NeptuneStopDbClusterOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/s3.py::S3DeleteObjectsOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py::SageMakerCreateNotebookOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py::SageMakerProcessingOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/step_function.py::StepFunctionStartExecutionOperator
Expand Down
Loading