mgorsk1 opened a new issue, #42363:
URL: https://github.com/apache/airflow/issues/42363
### Apache Airflow Provider(s)
amazon
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==8.28.0
### Apache Airflow version
2.9.1
### Operating System
Debian GNU/Linux 11 (bullseye)
### Deployment
Other 3rd-party Helm chart
### Deployment details
_No response_
### What happened
`S3DeleteObjectsOperator` fails when `to_datetime` or `from_datetime` are
defined as airflow macros.
### What you think should happen instead
`to_datetime` and `from_datetime` fields can be templated and are converted
from string to datetime in appropriate place.
### How to reproduce
Create dag with following task:
```
to_datetime = "{{ macros.ds_add(ds, -30) }}"
task = S3DeleteObjectsOperator(
task_id='delete_old_logs',
bucket='mybucket',
prefix='logs/',
to_datetime=to_datetime,
aws_conn_id=aws_conn_id
)
```
### Anything else
It would work if i pass to_datetime (or from_datetime) as `datetime.now() +
timedelta(days=-30)`. It is then confusing why these fields are accepted as
`template_fields`.
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]