devgonvarun opened a new issue, #69030:
URL: https://github.com/apache/airflow/issues/69030
### Under which category would you file this issue?
Providers
### Apache Airflow version
3.2.2
### What happened and how to reproduce it?
When running `airflow db clean` with either `--dag-ids` or
`--exclude-dag-ids`, the command fails with `RuntimeError: airflow db clean
encountered errors on the following tables and did not clean them:
['asset_event', 'deadline', 'task_reschedule']`.
## Steps to reproduce
1. Use Airflow 3.2.2.
2. Run the cleanup command without DAG filtering:
```bash
airflow db clean \
--clean-before-timestamp "$(date -d '15 days ago' '+%Y-%m-%d')" \
--error-on-cleanup-failure \
--skip-archive \
--tables
"_xcom_archive,asset_event,callback_request,celery_taskmeta,celery_tasksetmeta,import_error,job,session,sla_miss,task_reschedule,trigger,dag_run"
\
-y
```
This completes successfully.
3. Run the same command with `--dag-ids`:
```bash
airflow db clean \
--clean-before-timestamp "$(date -d '15 days ago' '+%Y-%m-%d')" \
--dag-ids "your_dag_id" \
--error-on-cleanup-failure \
--skip-archive \
--tables
"_xcom_archive,asset_event,callback_request,celery_taskmeta,celery_tasksetmeta,import_error,job,session,sla_miss,task_reschedule,trigger,dag_run"
\
-y
```
4. The command fails while cleaning `asset_event`, `deadline`, and
`task_reschedule`.
The same happens when using `--exclude-dag-ids`.
### What you think should happen instead?
`airflow db clean` should successfully respect `--dag-ids` /
`--exclude-dag-ids` for the selected tables
In particular, it should not fail on `asset_event`, `deadline`, or
`task_reschedule` when the command is otherwise valid and the same run works
without DAG filtering.
### Operating System
Debian GNU/Linux 12 (bookworm)
### Deployment
Official Apache Airflow Helm Chart
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
_No response_
### Official Helm Chart version
1.21.0
### Kubernetes Version
_No response_
### Helm Chart configuration
_No response_
### Docker Image customizations
_No response_
### Anything else?
Notes:
- `--dag-ids` and `--exclude-dag-ids` are both documented by `airflow db
clean --help`.
- The failure only occurs when those flags are used.
- The command works without DAG filtering.
### 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]