waterWang opened a new pull request, #72023: URL: https://github.com/apache/airflow/pull/72023
The `TaskReschedule` table was migrated in Airflow 3.0 (migration `0063`) from `dag_id`/`task_id`/`run_id` to `ti_id` (UUID FK to `task_instance.id`). The `dag_id` column was dropped. However, `db_cleanup.py`'s `_TableConfig` for `task_reschedule` still specified `dag_id_column_name="dag_id"`, causing the `_build_query` function to generate: ```sql SELECT count(*) FROM (SELECT base.* FROM task_reschedule AS base WHERE base.start_date < ... AND base.dag_id IN (...)) AS anon_1 ``` This fails with `column base.dag_id does not exist` on PostgreSQL (and similar errors on other databases) when `airflow db clean` is run with a `--dag-id` filter. **Fix:** Remove the `dag_id_column_name` from `task_reschedule`'s config, since the table no longer has a `dag_id` column and cannot be directly filtered by DAG ID. Other tables without a `dag_id` column (e.g., `import_error`, `callback_request`, `trigger`, `celery_taskmeta`) already omit this parameter — this fix makes `task_reschedule` consistent with them. Fixes #72020 -- 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]
